synolia / sylius-maintenance-plugin
Plugin for Sylius when your website is under maintenance
Installs: 43 450
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 11
Forks: 6
Open Issues: 1
Type:sylius-plugin
Requires
- php: ^8.0
- jaybizzle/crawler-detect: ^1.2
- sylius/sylius: ^1.10
- webmozart/assert: ^1.11
Requires (Dev)
- dbrekelmans/bdi: 1.0
- friendsoftwig/twigcs: 6.1.0
- phpmd/phpmd: 2.13.0
- phpro/grumphp: 1.15.0
- phpspec/phpspec: 7.3.0
- phpstan/extension-installer: 1.2.0
- phpstan/phpstan: 1.9.7
- phpstan/phpstan-doctrine: 1.3.29
- phpstan/phpstan-phpunit: 1.3.3
- phpstan/phpstan-strict-rules: 1.4.4
- phpstan/phpstan-webmozart-assert: 1.2.2
- phpunit/phpunit: 9.5.27
- rector/rector: ^0.15.2
- sylius-labs/coding-standard: 4.3.0
- symfony/browser-kit: 6.0.11
- symfony/debug-bundle: 6.0.11
- symfony/dotenv: 6.0.5
- symfony/intl: 6.0.15
- symfony/panther: 2.0.1
- symfony/web-profiler-bundle: 6.0.17
README
Sylius Maintenance Plugin
Features
When your website is under maintenance, and you want to :
- Do not allow access to your website and display the message "the website is under maintenance" on the frontpage.
- Allow access to your website to some Ips addresses or secret token
- Activate and deactivate these behaviors by commands
- Activate and deactivate behaviors in your Sylius Back-office
- Custom your message in your Sylius Back-office
- Allow access to search bots to avoid negative impact on SEO
Requirements
Installation
-
Add the bundle and dependencies in your composer.json :
composer require synolia/sylius-maintenance-plugin
-
Import required config in your
config/packages/_sylius.yaml
file:imports: - { resource: "@SynoliaSyliusMaintenancePlugin/Resources/config/config.yaml" }
-
Import routing in your
config/routes.yaml
file:synolia_maintenance: resource: "@SynoliaSyliusMaintenancePlugin/Resources/config/admin_routing.yaml" prefix: '/%sylius_admin.path_name%'
-
Clear cache
php bin/console cache:clear
Usage
-
To turn your website under maintenance, please create a file maintenance.yaml at the root of your project.
-
If you want to allow access for some Ips, please add these Ip into maintenance.yaml
For example :ips: [172.16.254.1, 255.255.255.255, 192.0.0.255]
You can turn your website under maintenance by console commands :
-
Enable the plugin
php bin/console maintenance:enable
-
Enable the plugin and add one or multiple ips addresses separated with a space
php bin/console maintenance:enable 172.16.254.1 255.255.255.255 192.0.0.255
-
Disable the plugin
php bin/console maintenance:disable
-
Remove configuration file using CLI
By default, maintenance.yaml configuration file remains when running maintenance:disable
or via admin panel using toggle disable
Nevertheless passing option [-c|--clear]
to command line above will reset previous saved configuration
You can also turn your website under maintenance in Back Office :
- Enable/disable the plugin
- Allow access for one or multiple ips addresses (optional)
- Allow access for secret token (optional)
- Create your custom message (optional)
- Grant access to search bots during maintenance (optional)
If you want to put the maintenance.yaml in a directory, please add your directory in .env:
For example :
SYNOLIA_MAINTENANCE_DIR=var/maintenance
If you want to add cache on the maintenance.yaml:
# .env SYNOLIA_MAINTENANCE_CACHE=30 # ttl in seconds
And in project code (for exemple with redis)
# config/packages/prod/cache.yaml framework: cache: ... pools: ... synolia_maintenance.cache: adapter: cache.adapter.redis
Development
See How to contribute.
License
This library is under the EUPL-1.2 license.
Credits
Developed by Synolia.