{"id":20684429,"url":"https://github.com/spiral-packages/maintenance","last_synced_at":"2025-08-21T08:14:19.994Z","repository":{"id":48914627,"uuid":"516435030","full_name":"spiral-packages/maintenance","owner":"spiral-packages","description":"\"disable\" your application while it is updating or when you are performing maintenance. ","archived":false,"fork":false,"pushed_at":"2022-09-16T11:35:59.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-16T15:00:15.545Z","etag":null,"topics":["maintenance","maintenance-mode","package","php","spiral","spiral-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spiral-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-21T15:57:45.000Z","updated_at":"2022-07-22T18:27:30.000Z","dependencies_parsed_at":"2022-09-24T00:24:15.843Z","dependency_job_id":null,"html_url":"https://github.com/spiral-packages/maintenance","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"spiral-packages/package-skeleton","purl":"pkg:github/spiral-packages/maintenance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiral-packages%2Fmaintenance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiral-packages%2Fmaintenance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiral-packages%2Fmaintenance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiral-packages%2Fmaintenance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spiral-packages","download_url":"https://codeload.github.com/spiral-packages/maintenance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spiral-packages%2Fmaintenance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271448397,"owners_count":24761438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maintenance","maintenance-mode","package","php","spiral","spiral-framework"],"created_at":"2024-11-16T22:21:42.390Z","updated_at":"2025-08-21T08:14:19.973Z","avatar_url":"https://github.com/spiral-packages.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This is my package maintenance\n\n[![PHP](https://img.shields.io/packagist/php-v/spiral-packages/maintenance.svg?style=flat-square)](https://packagist.org/packages/spiral-packages/maintenance)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spiral-packages/maintenance.svg?style=flat-square)](https://packagist.org/packages/spiral-packages/maintenance)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spiral-packages/maintenance/run-tests?label=tests\u0026style=flat-square)](https://github.com/spiral-packages/maintenance/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/spiral-packages/maintenance.svg?style=flat-square)](https://packagist.org/packages/spiral-packages/maintenance)\n\nThis is where your description should go. Limit it to a paragraph or two. Consider adding a small example.\n\n## Requirements\n\nMake sure that your server is configured with following PHP version and extensions:\n\n- PHP 8.1+\n- Spiral framework 3.0+\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require spiral-packages/maintenance\n```\n\nAfter package install you need to register bootloader from the package.\n\n```php\nprotected const LOAD = [\n    // ...\n    \\Spiral\\Maintenance\\Bootloader\\MaintenanceBootloader::class,\n];\n```\n\n\u003e Note: if you are using [`spiral-packages/discoverer`](https://github.com/spiral-packages/discoverer),\n\u003e you don't need to register bootloader by yourself.\n\n## Configuration\n\nBy default, the package uses `file` driver for storing information about maintenance mode. If you have multiple\ninstances of your application you need to use `cache` driver with storage that will be accessed from all instances.\n\n```dotenv\nMAINTENANCE_DRIVER=cache\nMAINTENANCE_CACHE_STORAGE=null\nMAINTENANCE_CACHE_KEY=maintenance\n```\n\n## Usage\n\nInclude `Spiral\\Maintenance\\Middleware\\PreventRequestInMaintenanceModeMiddleware` in your application for routes that\nshould not have access during maintenance mode.\n\n```php\nfinal class RoutesBootloader extends BaseRoutesBootloader\n{\n    protected function globalMiddleware(): array\n    {\n        return [\n            \\Spiral\\Maintenance\\Middleware\\PreventRequestInMaintenanceModeMiddleware::class,\n            // ...\n        ];\n    }\n}\n```\n\nTo enable maintenance mode, execute the down command:\n\n```bash\nphp app.php down\n```\n\nBy default, response code for maintenance mode is `503`, but you may set custom response code\n\n```bash\nphp app.php down --status=504\n```\n\nTo disable maintenance mode, use the up command:\n\n```bash\nphp app.php up\n```\n\nWhen your application is in maintenance mode the middleware\nthrows `Spiral\\Maintenance\\Exception\\MaintenanceModeHttpException` with defined status code. \n\nSpiral Framework allows you to pre-render a maintenance mode view that will be returned to the very beginning of the \nrequest cycle. You may pre-render a template of your choice using `App\\ErrorHandler\\ViewRenderer`. By default, it looks\nfor a template in a folder `app/views/exception/{statusCode}.dark.php`\n\nYou can create a new view file `app/views/exception/503.dark.php`:\n\n```php\n\u003cextends:layout.base title=\"[[Maintenance mode]]\"/\u003e\n\u003cuse:element path=\"embed/links\" as=\"homepage:links\"/\u003e\n\n\u003cstack:push name=\"styles\"\u003e\n    \u003clink rel=\"stylesheet\" href=\"/styles/welcome.css\"/\u003e\n\u003c/stack:push\u003e\n\n\u003cdefine:body\u003e\n    \u003cdiv class=\"wrapper\"\u003e\n        \u003cimg src=\"/images/503.svg\" alt=\"Error 503\" width=\"300px\"/\u003e\n        \u003ch2\u003e{{ $exception-\u003egetMessage() ?? 'Maintenance mode' }}\u003c/h2\u003e\n    \u003c/div\u003e\n\u003c/define:body\u003e\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [butschster](https://github.com/butschster)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiral-packages%2Fmaintenance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspiral-packages%2Fmaintenance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiral-packages%2Fmaintenance/lists"}