alengo / alengo-form-bundle
Form Bundle
Installs: 1 733
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:sulu-bundle
Requires
- php: ^8.1
- sulu/sulu: ^2.5
- symfony/config: ^6.0 || ^7.0
- symfony/dependency-injection: ^6.0 || ^7.0
- symfony/framework-bundle: ^6.0 || ^7.0
- symfony/http-foundation: ^6.0 || ^7.0
- symfony/http-kernel: ^6.0 || ^7.0
- symfony/mailer: ^6.0 || ^7.0
- symfony/serializer: ^6.0 || ^7.0
- symfony/twig-bundle: ^6.0 || ^7.0
Requires (Dev)
- handcraftedinthealps/zendsearch: ^2.0
- jackalope/jackalope-doctrine-dbal: ^1.3.4 || ^2.0
- php-cs-fixer/shim: ^3.9
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.9
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-symfony: ^1.2
- phpunit/phpunit: ^8.5 || ^9.5
- rector/rector: ^1.0.3
- sulu/sulu-rector: ^1.0.0
- symfony/browser-kit: ^6.0 || ^7.0
- symfony/console: ^6.0 || ^7.0
- symfony/dotenv: ^6.0 || ^7.0
- symfony/error-handler: ^6.0 || ^7.0
- symfony/monolog-bundle: ^3.1
This package is auto-updated.
Last update: 2024-11-27 08:54:35 UTC
README
Requirements
- PHP 8.0
- Symfony >=6.0
- Symfonymailer
Install the bundle
Execute the following composer command
composer require alengo/alengo-form-bundle
Enable the bundle
Enable the bundle by adding it to the list of registered bundles in the config/bundles.php
file of your project:
return [ /* ... */ Alengo\Bundle\AlengoFormBundle\AlengoFormBundle::class => ['all' => true], ];
bin/console do:sch:up --force
Configure the Bundle
Set the following config in your routes_admin.yaml
app_form_data_api: type: rest prefix: /admin/api resource: Alengo\Bundle\AlengoFormBundle\Controller\Admin\FormDataController name_prefix: app.
Define you default Sender Email in ENV Config.
DEFAULT_SENDER_MAIL=test@test.de
DEFAULT_SENDER_NAME=Mustermann
Use the Bundle
You can use and include the following two interfaces to save the forms and send an email with them
Alengo\Bundle\AlengoFormBundle\Service\SaveFormInterface
public function saveFormDataFromRequest(array $data, string $webspace, string $location, string $category, string $receiverMail = NULL, bool $copy = false): FormData;
Alengo\Bundle\AlengoFormBundle\Service\SendFormInterface
public function sendFormDataAsMail(FormData $formData, string $template, string $title, string $receiverMail,string $senderMail,$xmlTemplate = false);
Example
Simple example which sends a copy to the person who filled in the form and his deposited mail
$formData = $this->saveForm->saveFormDataFromRequest($request->request->all(),$request->get('_sulu')->getAttribute('webspace')->getKey(),$request->getLocale(),'contact',NULL,true); $this->sendForm->sendFormDataAsMail($formData,'hello/email.txt.twig','Welcome Mail','receiver@mail.de');