arobases / sylius-back-in-stock-notification-plugin
Timely inform customers and guest visitors when a product return in stock
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 8
Type:sylius-plugin
Requires
- php: ^7.3
- doctrine/dbal: ^2.13
- doctrine/migrations: ^3.1
- doctrine/orm: ^2.7
- psr/log: ^1.1
- sylius/mailer-bundle: ^1.5
- sylius/resource-bundle: ^1.6
- sylius/sylius: ^1.8.0
- symfony/config: ^4.4 || ^5.2
- symfony/console: ^4.4 || ^5.2
- symfony/dependency-injection: ^4.4 || ^5.2
- symfony/form: ^4.4 || ^5.2
- symfony/framework-bundle: ^4.4 || ^5.2
- symfony/http-foundation: ^4.4 || ^5.2
- symfony/http-kernel: ^4.4 || ^5.2
- symfony/translation: ^4.4
- symfony/translation-contracts: ^1.1.9
- symfony/validator: ^4.4 || ^5.2
- webmozart/assert: ^1.9
Requires (Dev)
- behat/behat: ^3.6.1
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- lakion/mink-debug-extension: ^1.2.3
- phpspec/phpspec: ^6.1
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: 0.12.64
- phpstan/phpstan-doctrine: 0.12.14
- phpstan/phpstan-strict-rules: ^0.12.0
- phpstan/phpstan-webmozart-assert: 0.12.4
- phpunit/phpunit: ^8.5
- sensiolabs/security-checker: ^6.0
- sylius-labs/coding-standard: ^4.0
- symfony/browser-kit: ^4.4
- symfony/debug-bundle: ^4.4|^5.0
- symfony/dotenv: ^4.4|^5.0
- symfony/intl: ^4.4|^5.0
- symfony/web-profiler-bundle: ^4.4|^5.0
- symfony/web-server-bundle: ^4.4|^5.0
- vimeo/psalm: 3.11.4
This package is not auto-updated.
Last update: 2024-11-12 15:51:44 UTC
README
Back in Stock Notification Plugin
Plugin that add the possibility to receive an email notification when a product return in stock
Features
Subscribe to get a Notification when a product return in stock
View your subscriptions in the apposite section of your account
View your client subscriptions in the apposite admin section
Requirements
- PHP
^7.3
- Sylius
^1.8
Installation
-
Run
composer require webgriffe/sylius-back-in-stock-notification-plugin
. -
Add the plugin to the
config/bundles.php
file:Webgriffe\SyliusBackInStockNotificationPlugin\WebgriffeSyliusBackInStockNotificationPlugin::class => ['all' => true],
-
Import the plugin routes by creating a file in
config/routes/webgriffe_sylius_back_in_stock_notification_plugin.yaml
with the follwing content:webgriffe_sylius_back_in_stock_notification_plugin: resource: "@WebgriffeSyliusBackInStockNotificationPlugin/Resources/config/routing.yaml"
-
Import required config in your
config/packages/webgriffe_sylius_back_in_stock_notification_plugin.yaml
file:imports: - { resource: "@WebgriffeSyliusBackInStockNotificationPlugin/Resources/config/app/config.yaml" }
-
Finish the installation by updating the database schema and installing assets:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate bin/console assets:install bin/console sylius:theme:assets:install
Configuration
This module send mail using a Symfony Command. Unfortunately, the command line context does not know about your VirtualHost or domain name. To fix this, you need to configure the “request context”, which is a fancy way of saying that you need to configure your environment so that it knows what URL it should use when generating URLs. For further information you can see Symfony Documentation.
- Edit the
config/services.yml
file by adding the following content:
parameters: router.request_context.host: example.org router.request_context.scheme: https
- As said early this module provide a command that check the stock of the product. You have to set the command
bin/console webgriffe:back-in-stock-notification:alert
in the crontab, once a day is enough:
0 12 * * * <absolute-php-path> <absolute-path-to-sylius-dir>/bin/console webgriffe:back-in-stock-notification:alert
Optional Configuration
If you want to use our Behat defined steps you have to include our Behat class in your autoloader-dev. To achieve this adds the following line to your composer.json
:
"autoload-dev": { "psr-4": { "Tests\\Webgriffe\\SyliusBackInStockNotificationPlugin\\": "vendor/webgriffe/sylius-back-in-stock-notification-plugin/tests/" } },
Contributing
To contribute to this plugin clone this repository, create a branch for your feature or bugfix, do your changes and then make sure al tests are passing.
```bash
(cd tests/Application && yarn install)
(cd tests/Application && yarn build)
(cd tests/Application && APP_ENV=test bin/console assets:install public)
(cd tests/Application && APP_ENV=test bin/console doctrine:database:create)
(cd tests/Application && APP_ENV=test bin/console doctrine:schema:create)
```
To be able to setup a plugin's database, remember to configure you database credentials in tests/Application/.env
and tests/Application/.env.test
.
Running plugin tests
- PHPUnit
vendor/bin/phpunit
-
PHPSpec
vendor/bin/phpspec run
-
Behat (non-JS scenarios)
vendor/bin/behat --strict --tags="~@javascript"
-
Behat (JS scenarios)
-
Start Headless Chrome:
google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
-
Install SSL certificates (only once needed) and run test application's webserver on
127.0.0.1:8080
:symfony server:ca:install APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
-
Run Behat:
```bash vendor/bin/behat --strict --tags="@javascript" ```
-
Static Analysis
-
Psalm
vendor/bin/psalm
-
PHPStan
vendor/bin/phpstan analyse -c phpstan.neon -l max src/
-
-
Coding Standard
vendor/bin/ecs check src
Opening Sylius with your plugin
-
Using
test
environment:(cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load) (cd tests/Application && APP_ENV=test bin/console server:run -d public)
-
Using
dev
environment:(cd tests/Application && APP_ENV=dev bin/console sylius:fixtures:load) (cd tests/Application && APP_ENV=dev bin/console server:run -d public)
License
This plugin is under the MIT license. See the complete license in the LICENSE file.
Credits
Developed by Webgriffe®.