mesavolt / five-oh-three
Maintenance page, pretty and simple.
Installs: 5 991
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- willdurand/negotiation: ^3.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.2
This package is auto-updated.
Last update: 2024-11-30 01:40:04 UTC
README
Easy to setup maintenance page.
Installation
composer require mesavolt/five-oh-three
Usage
In your app's entry point (something like public/app.php
or web/app.php
),
add these lines before the code that should only run if the lock file is not present :
<?php // replace the `use` line with this if you don't use Composer's autoloader // require __DIR__.'/../vendor/mesavolt/five-oh-three/src/LockGuard.php'; use Mesavolt\FiveOhThree\LockGuard; LockGuard::checkAndRender();
Before deploying your application, create a deploying.lock file in your project's root directory. Remove it once your app can go live:
# deploy-my-project.sh # Create the lock file touch deploying.lock # Here goes your usual deployment steps export SYMFONY_ENV=prod composer -n --ansi --no-dev install --optimize-autoloader bin/console --ansi -n --env=prod cache:clear --no-warmup # ... # Remove the lock file rm deploying.lock
Customization
<?php use Mesavolt\FiveOhThree\LockGuard; LockGuard::checkAndRender([ 'lock_path' => __DIR__.'/../estoy-deployin.lock', // path to lock file 'template' => __DIR__.'/res/deploying.html', // path to custom template (can either be a PHP or HTML file) // when using the default template: 'auto_refresh' => false, // you can disable the auto-refresh... 'auto_refresh_interval' => 30, // ... or customize its interval 'icon' => 'http://bestanimations.com/Site/Construction/under-construction-animated-gif-8.gif', ]);
Testing
# run this once when you clone the project composer install # run this before every test to make sure vendor/autoload.php exists and is up-to-date, # especially if you changed some namespaces composer dump-autoload # launch the test suite ./vendor/bin/phpunit