2017 © Pedro PelĂĄez
 

symfony-bundle contact-bundle

Implementation of a contact form for Symfony2

image

fruitware/contact-bundle

Implementation of a contact form for Symfony2

  • Tuesday, March 24, 2015
  • by fruitware.ru
  • Repository
  • 2 Watchers
  • 0 Stars
  • 67 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 23 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

MremiContactBundle

SensioLabsInsight, (*1)

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality Code Coverage, (*2)

This bundle provides a contact form in Symfony2., (*3)

License

This bundle is available under the MIT license., (*4)

Prerequisites

This version of the bundle requires Symfony 2.3+., (*5)

Translations

If you wish to use default texts provided in this bundle, you have to make sure you have translator enabled in your config., (*6)

``` yaml, (*7)

app/config/config.yml

framework: translator: ~, (*8)


For more information about translations, check the [Symfony documentation](http://symfony.com/doc/current/book/translation.html). ## Installation Installation is a quick 6 step process: 1. Download MremiContactBundle using composer 2. Enable the Bundle 3. Create your Contact class (optional) 4. Configure the MremiContactBundle 5. Import MremiContactBundle routing 6. Update your database schema (optional) ### Step 1: Download MremiContactBundle using composer Add MremiContactBundle in your composer.json: ```js { "require": { "mremi/contact-bundle": "dev-master" } }

Now tell composer to download the bundle by running the command:, (*9)

``` bash $ php composer.phar update mremi/contact-bundle, (*10)


Composer will install the bundle to your project's `vendor/mremi` directory. ### Step 2: Enable the bundle Enable the bundle in the kernel: ``` php For now, only Doctrine ORM is handled by this bundle (any PR will be > appreciated :) ). ``` php <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="Acme\ContactBundle\Entity\Contact" table="contact"> <id name="id" column="id" type="integer"> <generator strategy="AUTO" /> </id> </entity> </doctrine-mapping>

Step 4: Configure the MremiContactBundle

The bundle comes with a sensible default configuration, which is listed below. However you have to configure at least a recipient address., (*11)

# app/config/config.yml
mremi_contact:
    store_data:            false
    contact_class:         Mremi\ContactBundle\Model\Contact

    form:
        type:              mremi_contact
        name:              contact_form
        validation_groups: [Default]
        subject_provider:  mremi_contact.subject_provider.noop

    email:
        mailer:            mremi_contact.mailer.twig_swift
        recipient_address: # Required
        template:          MremiContactBundle:Contact:email.txt.twig

You can also configure your favorite captcha. You have to install it by yourself and configure it here. You can get one from these bundles:, (*12)

Or even implement your own., (*13)

# app/config/config.yml
mremi_contact:
    form:
        captcha_type:      genemu_captcha # or any other (genemu_recaptcha, ewz_recaptcha, ...)

Step 5: Import MremiContactBundle routing

Now that you have activated and configured the bundle, all that is left to do is import the MremiContactBundle routing file., (*14)

By importing the routing file you will have ready access the contact form., (*15)

In YAML:, (*16)

``` yaml, (*17)

app/config/routing.yml

mremi_contact_form: resource: "@MremiContactBundle/Resources/config/routing.xml", (*18)


Or if you prefer XML: ``` xml <!-- app/config/routing.xml --> <import resource="@MremiContactBundle/Resources/config/routing.xml"/>

Note:, (*19)

In order to use the built-in email functionality, you must activate and configure the SwiftmailerBundle., (*20)

Step 6: Update your database schema (optional)

If you configured the data storage (step 3), you can now update your database schema., (*21)

If you want to first see the create table query:, (*22)

``` bash $ app/console doctrine:schema:update --dump-sql, (*23)


Then you can run it: ``` bash $ app/console doctrine:schema:update --force

You can now access to the contact form at http://example.com/app_dev.php/contact!, (*24)

Note:, (*25)

If your are in debug mode (see your front controller), the HTML5 validation can be disabled by adding ?novalidate=1 to the URL., (*26)

Bootstrap

Bootstrap framework v3.0.2 is loaded and used in templates provided by this bundle., (*27)

Screenshot, (*28)

Customization

Templating

If you want to customize some parts of this bundle (views for instance), read the Symfony documentation., (*29)

Events

The contact controller dispatches 3 events during the index action:, (*30)

  1. ContactEvents::FORM_INITIALIZE occurs when the form is initialized
  2. ContactEvents::FORM_SUCCESS occurs when the form is submitted successfully
  3. ContactEvents::FORM_COMPLETED occurs after saving the contact in the contact form process

Each one allows you to customize the default workflow provided by this bundle., (*31)

Contribution

Any question or feedback? Open an issue and I will try to reply quickly., (*32)

A feature is missing here? Feel free to create a pull request to solve it!, (*33)

I hope this has been useful and has helped you. If so, share it and recommend it! :), (*34)

@mremitsme, (*35)

The Versions

24/03 2015

dev-feature/refactoring

dev-feature/refactoring https://github.com/Fruitware/ContactBundle

Implementation of a contact form for Symfony2

  Sources   Download

MIT

The Requires

 

form symfony2 contact

07/03 2015

dev-master

9999999-dev https://github.com/Fruitware/ContactBundle

Implementation of a contact form for Symfony2

  Sources   Download

MIT

The Requires

 

by RĂ©mi Marseille

form symfony2 contact

24/01 2015

dev-feature/sonata-pages-support

dev-feature/sonata-pages-support https://github.com/mremi/ContactBundle

Implementation of a contact form for Symfony2

  Sources   Download

MIT

The Requires

 

by RĂ©mi Marseille

form symfony2 contact

21/08 2013

v1.0.1

1.0.1.0 https://github.com/mremi/ContactBundle

Implementation of a contact form for Symfony2

  Sources   Download

MIT

The Requires

 

by RĂ©mi Marseille

form contact

18/07 2013

v1.0.0

1.0.0.0 https://github.com/mremi/ContactBundle

Implementation of a contact form for Symfony2

  Sources   Download

MIT

The Requires

 

by RĂ©mi Marseille

form contact