daycry / maintenancemode
Maintenance mode for Codeigniter 4
Installs: 6 048
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=7.4
Requires (Dev)
- codeigniter4/framework: 4.2.3
- friendsofphp/php-cs-fixer: 3.6.*
- mikey179/vfsstream: ^1.6
- nexusphp/cs-config: ^3.3
- nexusphp/tachycardia: ^1.0
- phpstan/phpstan: ^1.7.1
- phpunit/phpunit: ^9.5
- rector/rector: 0.13.9
README
Maintenance Mode for Codeigniter 4
Installation via composer
Use the package with composer install
> composer composer require daycry/maintenancemode
Manual installation
Download this repo and then enable it by editing app/Config/Autoload.php and adding the Daycry\Maintenance namespace to the $psr4 array. For example, if you copied it into app/ThirdParty:
$psr4 = [ 'Config' => APPPATH . 'Config', APP_NAMESPACE => APPPATH, 'App' => APPPATH, 'Daycry\Maintenance' => APPPATH .'ThirdParty/maintenancemode/src', ];
Configuration
Run command:
> php spark mm:publish
This command will copy a config file to your app namespace.
Then you can adjust it to your needs. By default file will be present in app/Config/Maintenance.php
.
Commands Available
php spark mm:down php spark mm:status php spark mm:up
Use it
Method 1 (Recommended)
Create new event in app/Config/Events.php
Events::on( 'pre_system', 'Daycry\Maintenance\Controllers\Maintenance::check' );
Method 2
edit application/Config/Filters.php and add the new line in $aliases array:
public $aliases = [ 'maintenance' => \Daycry\Maintenance\Filters\Maintenance::class, ... ]
and add "maintenance" in $globals['before'] array:
public $globals = [ 'before' => [ 'maintenance', ... ], 'after' => [ ... ], ];