Skip to content
This Laravel 7 package makes it possible for you to set your website in "Under Construction" mode. Only users with the correct 4 digit code can access your site. 🔥 💥 🔥
PHP Vue HTML JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
config fixing styleci Oct 28, 2019
output Add user-select none Apr 14, 2020
resources Add user-select none Apr 14, 2020
src Fix redirect url Feb 18, 2020
tests Fix test Mar 4, 2020
.gitignore Ignore DS_Store Oct 8, 2017
.styleci.yml Order namespaces by length Dec 15, 2018
.travis.yml Revert "Laravel 5.6 Compatibility " Feb 8, 2018
CHANGELOG.MD add changelog Oct 2, 2017 Update license Feb 22, 2018 Add Laravel 7 support Mar 4, 2020
composer.json Add Laravel 7 support Mar 4, 2020
package.json Pump dependencies Jan 10, 2020
phpunit.xml.dist Add phpunit settings file Oct 7, 2017
webpack.mix.js breaking Sep 25, 2017
yarn.lock add vue loading overlay Oct 25, 2018

Laravel Under Construction schermafbeelding 2017-09-27 om 23 08 12

StyleCI Packagist Total Downloads

Buy Me A Coffee

This Laravel package makes it possible to set your website in "Under Construction" mode. Only users with the correct 4 digit code can access your site. This package can for example be useful to show your website to a specific client. Everything works out of the box, and it's fully customizable.

If you appreciate my work please give this repo a star or buy me a coffee ^ 🤗.



Begin by installing this package through Composer (Laravel 5.8, 6 and 7 compatible!).

composer require larsjanssen6/underconstruction

The \LarsJanssen\UnderConstruction\UnderConstruction::class middleware must be registered in the kernel:


protected $routeMiddleware = [
  // ...
  'under-construction' => \LarsJanssen\UnderConstruction\UnderConstruction::class,


Publish the default configuration file.

php artisan vendor:publish

# Or...

php artisan vendor:publish --provider="LarsJanssen\UnderConstruction\UnderConstructionServiceProvider"

This package is fully customizable. This is the content of the published config file under-construction.php:


return [

     * Activate under construction mode.
    'enabled' => env('UNDER_CONSTRUCTION_ENABLED', true),

     * Hash for the current pin code
    'hash' => env('UNDER_CONSTRUCTION_HASH', null),

     * Under construction title.
    'title' => 'Under Construction',

     * Custom Route Prefix
     * */
    'route-prefix' => env('UNDER_CONSTRUCTION_ROUTE_PREFIX','under'),

     * Custom Endpoint if you don't want to use 'construction'
     * e.g. if you change to 'checkpoint', the route prefix
     * above will be appended giving you 'under/checkpoint'
     * */
    'custom-endpoint' => env('UNDER_CONSTRUCTION_CUSTOM_ENDPOINT','construction'),

     * Back button translation.
    'back-button' => 'back',

    * Show button translation.
    'show-button' => 'show',

     * Hide button translation.
    'hide-button' => 'hide',

     * Show loader.
    'show-loader' => true,

     * Redirect url after a successful login.
    'redirect-url' => '/',

     * Enable throttle (max login attempts).
    'throttle' => true,

        | Throttle settings (only when throttle is true)

        * Set the amount of digits (max 6).
        'total_digits' => 4,

         * Set the maximum number of attempts to allow.
        'max_attempts' => 3,

         * Show attempts left.
        'show_attempts_left' => true,

         * Attempts left message.
        'attempts_message' => 'Attempts left: %i',

         * Too many attempts message.
        'seconds_message' => 'Too many attempts please try again in %i seconds.',

         * Set the number of minutes to disable login.
        'decay_minutes' => 5,

         * Prevent the site from being indexed by Robots when locked
        'lock_robots' => true,


You'll have to set a 4 digit code (you can change this up to 6 in config file). You can do that by running this custom artisan command (in this example the code is 1234 ,you can obviously set another code). It will generate a hash that will be stored in your .env file.

php artisan code:set 1234

You can set routes to be in "Under Construction" mode by using the under-construction-middleware on them.

Route::group(['middleware' => 'under-construction'], function () {
    Route::get('/live-site', function() {
        echo 'content!';


Please see CHANGELOG for more information on what has changed recently.


composer test


I would love to hear your ideas to improve my codeing style and conventions. Feel free to contribute.


If you discover any security related issues, please email You can also make an issue.


About me

I'm Lars Janssen from The Netherlands and like to work on web projects. You can follow me on Twitter.


The MIT License (MIT). Please see License File for more information.

❤️ Open-Source Software - Give ⭐️

We have included the awesome symfony/thanks composer package as a dev dependency. Let your OS package maintainers know you appreciate them by starring the packages you use. Simply run composer thanks after installing this package. (And not to worry, since it's a dev-dependency it won't be installed in your live environment.)

You can’t perform that action at this time.