PHPackages                             jrl05k/laravel-under-construction - 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. jrl05k/laravel-under-construction

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

jrl05k/laravel-under-construction
=================================

Laravel middleware to display under construction message

1.0.0(9y ago)35.8k2MITPHPPHP &gt;=5.3.0

Since May 5Pushed 7y ago3 watchersCompare

[ Source](https://github.com/jrl05k/laravel-under-construction)[ Packagist](https://packagist.org/packages/jrl05k/laravel-under-construction)[ RSS](/packages/jrl05k-laravel-under-construction/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

laravel-under-construction
==========================

[](#laravel-under-construction)

Laravel middleware to display under construction message with an option to login

Description
-----------

[](#description)

It's simple. The middleware redirects to the under construction page. This may useful in instances when you want push a release that is still "under construction" to a live server. Then you can use the middleware to display an under construction page to visitors.

If you want to allow certain visitors to be able to see the site you can enable the login option in your .env file.

To make development easier, you can also disable the under construction redirect when the request ip is the localhost. Similarly, when on live server you can disable the under construction message when the request is from certain ip addresses.

You can enable/disable the under construction message for everyone at any point by changing the .env value.

However, when you are ready to go live and no longer need the under construction message, you should remove the middleware from the kernel.

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

[](#installation)

composer require jrl05k/laravel-under-construction

Provider
--------

[](#provider)

Add **UnderConstruction\\UnderConstructionProvider::class** to *config/app.php* providers. (only for &lt;5.5.x)

```
  'providers' => [
    ...
    ...
    /*
     * Other Service Providers...
     */
    UnderConstruction\UnderConstructionProvider::class,
    ...
    ...
```

Middleware
----------

[](#middleware)

It's a simple middleware that will redirect to an "under construction" page.

But, it can be enabled to have a login to bypass the under construction page.

Add **\\UnderConstruction\\RedirectIfUnderConstructionMiddleware::class** to *Kernel.php* middlewareGroups web.

```
  protected $middlewareGroups = [
    'web' => [
      ...
      \UnderConstruction\RedirectIfUnderConstructionMiddleware::class
      ...
```

.env
----

[](#env)

You will need to add the following to your .env and set them accordingly

- **UNDER\_CONSTRUCTION=** {true/false}
- **UNDER\_CONSTRUCTION\_ON\_LOCALHOST=** {true/false}
- **UNDER\_CONSTRUCTION\_ALLOWED\_IP\_ADDRESSES=** {8.8.8.8,8.8.4.4} *(also can be blank, null, or false for none)*
- **UNDER\_CONSTRUCTION\_LOGIN\_ALLOWED=** {true/false}
- **UNDER\_CONSTRUCTION\_LOGIN\_KEY=** {123457890}

### .env Settings

[](#env-settings)

- If UNDER\_CONSTRUCTION=true is set in .env, the middleware will redirect to the under construction page for all routes.
- To have under contruction disabled on localhost set UNDER\_CONSTRUCTION\_ON\_LOCALHOST=false
- When on a remote server, if you want to access the site from your ip, or give access to others, add the ip addresses separated by commas to the .env UNDER\_CONSTRUCTION\_ALLOWED\_IP\_ADDRESSES
- If you want to give access to someone, but do not have their ip address, or the ip address is shared, you can enable the login page in .env with UNDER\_CONSTRUCTION\_LOGIN\_ALLOWED=true
- If you are using the login page set the key in .env UNDER\_CONSTRUCTION\_LOGIN\_KEY

Apply to specific routes only
-----------------------------

[](#apply-to-specific-routes-only)

If you want to apply the under construction redirect to certain routes, then instead of putting the middleware in the $middlewareGroups 'web' group, you should put it in the $routeMiddleware array. Then put a route group around the routes you want protected.

Example:

In Kernel.php

```
  $routeMiddleware => [
    ...
    'under-construction' => \UnderConstruction\RedirectIfUnderConstructionMiddleware::class,
    ...
```

In routes/web.php

```
  Route::get('/', function () {
    return view('welcome');
  });

  Route::group(['middleware'=>'under-construction'], function() {
    // the routes you want protected...
    Route::get('/some-page', ...
    Route::get('/another-page', ...
    ...
  });
```

Custom views
------------

[](#custom-views)

If you want to use a custom under construction page, you can over-ride the views by placing view file in path:

> resources/views/vendor/underconstruction/under\_construction.blade.php

Likewise, to over-ride the log in create your view in path:

> resources/views/vendor/underconstruction/under\_construction\_login.blade.php

Disable
-------

[](#disable)

To temporarily turn off the under construction message, you can set the .env UNDER\_CONSTRUCTION variable to false.

But to permanently disable it when it is no longer needed for a live production site, you should remove the **\\UnderConstruction\\RedirectIfUnderConstructionMiddleware::class** middleware from the Kernel.php. Keeping it in middleware and just disabling it by the .env setting will have a performance cost; so it is best to remove it completely from the Kernel.php middleware.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3344d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4592913?v=4)[jrl05k](/maintainers/jrl05k)[@jrl05k](https://github.com/jrl05k)

---

Top Contributors

[![jrl05k](https://avatars.githubusercontent.com/u/4592913?v=4)](https://github.com/jrl05k "jrl05k (13 commits)")[![mariolopjr](https://avatars.githubusercontent.com/u/2067324?v=4)](https://github.com/mariolopjr "mariolopjr (2 commits)")

---

Tags

middlewarelaravelunder construction

### Embed Badge

![Health badge](/badges/jrl05k-laravel-under-construction/health.svg)

```
[![Health](https://phpackages.com/badges/jrl05k-laravel-under-construction/health.svg)](https://phpackages.com/packages/jrl05k-laravel-under-construction)
```

###  Alternatives

[timacdonald/has-parameters

A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.

228288.1k4](/packages/timacdonald-has-parameters)[reinink/remember-query-strings

Laravel middleware that automatically remembers and restores query strings.

76638.4k3](/packages/reinink-remember-query-strings)[yemenifree/laravel-arabic-numbers-middleware

auto transforms arabic/eastern to eastern/arabic numbers for i.e ١٢٣٤٥٦٧٨ to 12345678

18135.6k](/packages/yemenifree-laravel-arabic-numbers-middleware)[arubacao/aws-ip-range-middleware

Laravel Middleware for Amazon Web Services (AWS) IP Address Range

172.3k](/packages/arubacao-aws-ip-range-middleware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
