PHPackages                             brickx/maintenance-switch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. brickx/maintenance-switch

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brickx/maintenance-switch
=========================

Simple plugin to toggle maintenance mode from Filament Panels.

1.0.3(1y ago)1925.8k↑12.5%11[4 PRs](https://github.com/Keysaw/maintenance-switch/pulls)1MITPHPPHP ^8.1CI passing

Since Sep 13Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/Keysaw/maintenance-switch)[ Packagist](https://packagist.org/packages/brickx/maintenance-switch)[ Docs](https://github.com/Keysaw/maintenance-switch)[ GitHub Sponsors](https://github.com/Brickx)[ RSS](/packages/brickx-maintenance-switch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (7)Used By (1)

Filament Maintenance Switch Plugin
==================================

[](#filament-maintenance-switch-plugin)

[![GitHub Tests Action Status](https://camo.githubusercontent.com/303ca93b192423e0a0c11f391b5f012c06d4d3730f448651c0bb373dc125239b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4b65797361772f6d61696e74656e616e63652d7377697463682f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473266c6f676f3d476974487562)](https://github.com/Keysaw/maintenance-switch/actions?query=workflow%3Arun-tests+branch%3Amain)[![Packagist Downloads](https://camo.githubusercontent.com/97c0857caafea8d919647dd201ddf434e0410eb67140dd861501eabdf591d085/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f627269636b782f6d61696e74656e616e63652d7377697463683f6c6f676f3d5061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c3d5061636b616769737426636f6c6f723d6f72616e6765)](https://packagist.org/packages/brickx/maintenance-switch)

This plugin allows you to easily toggle maintenance mode from your Filament Panels. You can also set a custom secret token to bypass the maintenance mode.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Setup](#setup)
- [Usage](#usage)
    - [Secret Token](#secret-token)
    - [Refresh Interval](#refresh-interval)
    - [Visibility](#visibility)
    - [Placement](#placement)
    - [Theming](#theming)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require brickx/maintenance-switch
```

You can publish the config file with:

```
php artisan vendor:publish --tag="maintenance-switch-config"
```

This is the contents of the published config file:

```
return [
    'secret' => null,
    'refresh' => false,
    'permissions' => false,
    'role' => false,
    'render_hook' => 'global-search.before',
    'icon' => 'heroicon-m-beaker',
    'tiny_toggle' => false,
];
```

You can publish the translations with:

```
php artisan vendor:publish --tag="maintenance-switch-translations"
```

Optionally, you can publish the views using:

```
php artisan vendor:publish --tag="maintenance-switch-views"
```

Setup
-----

[](#setup)

First, instantiate the plugin in your Panel's configuration:

```
use Brickx\MaintenanceSwitch\MaintenanceSwitchPlugin;

...

public function panel(Panel $panel) : Panel
{
    return $panel
        ->plugins([
            MaintenanceSwitchPlugin::make(),
        ]);
}
```

Laravel 11 does not come with the `PreventRequestsDuringMaintenance` middleware any more. You can create one with:

```
php artisan make:middleware PreventRequestsDuringMaintenance
```

Then fill it with the content below:

```
