Developed with love by KnpLabs Hire us for your project!
21

FrequenceWebContactBundle

by yohang

A simple contact bundle

FrequenceWebContactBundle

Build Status

An event-based Symfony2 Contact Bundle.

Installation

Install the bundle via composer

 $ composer require frequence-web/contact-bundle:1.0.*

Add the bundle to your AppKernel class


    public function registerBundles()
    {
        return array(
            // ... Your bundles
            new \FrequenceWeb\Bundle\ContactBundle\FrequenceWebContactBundle(),
        );
    }

Configuration

This bundle provides some configuration options :


frequence_web_contact:
    send_mails: true                # True to use the bundle EmailListener that send emails when contact form is submited
    to:         null                # The contact mail recipient
    from:       null                # The contact mail sender
    subject:    contact.message.new # The contact mail subject translation key

Routing

If you want to use the default bundle urls, just import the routing file in your application routing:

    _frequence_web_contact:
        resource: '@FrequenceWebContactBundle/Resources/config/routing.xml'

This will create 2 routes, with the same URL (/contact.html), one for displaying the contact
form (GET), the other to submit data (POST)

Creating Listener

If you want to make a more featured mail listener, or any other listener, you have to define your own.
The dispatched event on success contact form submit is contact.submit, and receive a
FrequenceWeb\Bundle\ContactBundle\EventDispatcher\Event\MessageSubmitEvent.

If you need an example, juste have a look to
FrequenceWeb\Bundle\ContactBundle\EventDispatcher\Listener\EmailContactListener.

Extending

If you need more datas that the few ones provided by the Contact class and the ContactType form type, just
override the frequence_web_contact.type.class and frequence_web_contact.model.class configuration parameters,
they are used to instantiate services and can be extended without any limit.

Copyright (c) 2012 Fréquence Web

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
frequence_web_contact:
send_mails: true
to: ~
from: no-reply@example.com
subject: contact.message.new
  • Updated dependencies to Sf2.8
    By yohang, 2 years ago
  • Made compatible with Symfony 3
    By yohang, 2 years ago
  • Made Symfony3 compatible in composer version constraint
    By yohang, 2 years ago
  • Merge pull request #5 from alister/patch-1
    By yohang, 5 years ago
  • improved English language translation
    By alister, 5 years ago
  • Fixed composer dependencies
    By yohang, 5 years ago
  • Merge pull request #4 from winzou/fix-controller
    By yohang, 6 years ago
  • Fix the way flash messages are set
    By winzou, 6 years ago
  • Fixed a translation key
    By yohang, 6 years ago
  • Try composer install with --prefer-source for Travis CI
    By yohang, 6 years ago
  • Update .travis.yml
    By yohang, 6 years ago
  • Update .travis.yml
    By yohang, 6 years ago
  • Fixed travis configuration
    By yohang, 6 years ago
  • Merge pull request #2 from yohang/qualitize
    By yohang, 6 years ago
  • Added README
    By yohang, 6 years ago
  • Added LICENSE file
    By yohang, 6 years ago
  • Added .travis.yml
    By yohang, 6 years ago
  • Added base test application
    By yohang, 6 years ago
  • Fixed dependencies
    By yohang, 6 years ago
  • Updated Dev Dependencies
    By yohang, 6 years ago
  • Updated composer.lock and gitignore
    By yohang, 6 years ago
  • Updated dependencies
    By yohang, 6 years ago
  • Fixed some CS
    By yohang, 6 years ago
  • Updated routing, used same URL with _method requirement
    By yohang, 6 years ago
  • Used a referer to redirect after success
    By yohang, 7 years ago
  • Updated type for sf2.1
    By Nek-, 7 years ago
  • Merge branch 'master' of github.com:yohang/FrequenceWebContactBundle
    By yohang, 7 years ago
  • Added composer.json
    By yohang, 7 years ago
  • Added empty README
    By yohang, 7 years ago
  • Added test structure
    By yohang, 7 years ago