mesavolt / five-oh-three
维护页面,美观且简单。
v2.2.3
2023-05-01 11:18 UTC
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-08-30 01:07:12 UTC
README
易于设置的维护页面。
安装
composer require mesavolt/five-oh-three
使用
在你的应用的入口点(例如 public/app.php
或 web/app.php
),在以下代码之前添加这些行,以确保只有在没有锁文件时才执行这些代码
<?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();
在部署您的应用程序之前,在项目的根目录中创建一个名为 deploying.lock 的文件。一旦您的应用可以上线,请删除该文件
# 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
自定义
<?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', ]);
测试
# 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