kphoen / contact-bundle
Yet another contact bundle
Installs: 2 706
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 5
Forks: 4
Open Issues: 0
Type:symfony-bundle
Requires
- php: ~7.0
- sensio/framework-extra-bundle: ^3.0
- symfony/framework-bundle: ^2.7|^3.0
- symfony/swiftmailer-bundle: ^2.3
- symfony/translation: ^2.7|^3.0
- symfony/twig-bundle: ^2.7|^3.0
Requires (Dev)
- phpunit/phpunit: ~4.8
- satooshi/php-coveralls: ^1.0
- symfony/symfony: ^2.7|^3.0
This package is auto-updated.
Last update: 2022-01-27 19:59:54 UTC
README
Yet another contact bundle.
Installation
Composer
Add kphoen/contact-bundle
to your required field. Then install/update your
dependencies.
app/AppKernel.php
Register the KPhoenContactBundle
:
# app/AppKernel.php public function registerBundles() { $bundles = array( // ... new KPhoen\ContactBundle\KPhoenContactBundle(), ); }
Configuration
config.yml
The following options are available in the app/config/config.yml
file:
k_phoen_contact: redirect_url: homepage # the url to redirect the user to once the # mail is sent sender: { address: 'no-reply@foo.org' } receiver: { address: 'contact@foo.org' }
Routing
Import the routes:
kphoen_contact: resource: "@KPhoenContactBundle/Resources/config/routing.yml"
Usage
Routes
The previous configuration imports a route named contact
in your application,
which correspond to a simple contact form.
Templates
You will probably need to customize the view used by the bundle. To do that, we will override the templates exposed by the contact bundle.
In app/Resources/KPhoenContactBundle/views/Contact/contact.html.twig
:
{% extends 'AcmeDemoBundle::layout.html.twig' %} {% block title %}Contact{% endblock %} {% block body %} <h2>Contact</h2> {% include "KPhoenContactBundle:Contact:form.html.twig" with {'form': form} %} {% endblock %}
Events
Two events are emitted during the submission of the event form:
contact.pre_send
: emitted just before the mail is sent ;contact.post_send
: emitted just after.
Contributing
See the CONTRIBUTING file.