roshyo / age-verification-plugin
Provides a way to check customers age in Sylius.
Installs: 231
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Type:sylius-plugin
Requires
- php: ^7.1
- sylius/sylius: ^1.1
Requires (Dev)
- behat/behat: ^3.3
- behat/mink: ^1.7
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/context-service-extension: ^1.0
- friends-of-behat/cross-container-extension: ^1.0
- friends-of-behat/service-container-extension: ^1.0
- friends-of-behat/symfony-extension: ^1.0
- friends-of-behat/variadic-extension: ^1.0
- lakion/mink-debug-extension: ^1.2.3
- phpspec/phpspec: ^3.2
- phpstan/phpstan-shim: ^0.9.2
- phpunit/phpunit: ^6.5
- se/selenium-server-standalone: ^2.52
- sylius-labs/coding-standard: ^1.0
- symplify/easy-coding-standard: ^2.4
This package is auto-updated.
Last update: 2025-02-27 23:19:51 UTC
README
Provides a way to check customers age in Sylius.
Installation-procedure
$ composer require behappy/age-verification-plugin
Enable the plugin
// in app/AppKernel.php public function registerBundles() { $bundles = array( // ... new \BeHappy\SyliusAgeVerificationPlugin\BeHappySyliusAgeVerificationPlugin(), ); // ... }
#in app/config/config.yml imports: ... - { resource: "@BeHappySyliusAgeVerificationPlugin/Resources/config/app/config.yml" }
Front office
You'll now need to override registration form since the age isn't required by default by Sylius. To do so :
{# /app/Resources/SyliusShopBundle/views/Register/_form.html.twig #} <h4 class="ui dividing header">{{ 'sylius.ui.personal_information'|trans }}</h4> <div class="two fields"> {{ form_row(form.firstName) }} {{ form_row(form.lastName) }} </div> <div class="two fields"> {{ form_row(form.email) }} {{ form_row(form.birthday) }} </div> {{ form_row(form.phoneNumber) }} {{ form_row(form.subscribedToNewsletter) }} <h4 class="ui dividing header">{{ 'sylius.ui.account_credentials'|trans }}</h4> {{ form_row(form.user.plainPassword.first) }} {{ form_row(form.user.plainPassword.second) }}
This is an example, adapt it to your needs.
That's it !
Now, everytime a customer will try to registrate, the birthday will be required, and must be over 18 (default)
Same for creating a customer in the BackOffice.
Configuration
You can redefine the required age by overriding this parameter :
# in app/config.yml parameters: ... be_happy.age_verification.minimal_age: 21 ...
Feel free to contribute
You can also ask your questions at the mail address in the composer.json mentioning this package.
Other
You can also check our other packages (including Sylius plugins) at https://github.com/BeHappyCommunication