PHPackages                             elic-dev/laravel-site-protection - 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. elic-dev/laravel-site-protection

ActiveLibrary

elic-dev/laravel-site-protection
================================

Protect your site with a simple password form

1.2.0(2y ago)45266.9k—8.3%12MITPHPPHP &gt;=5.6.4

Since May 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/elic-dev/laravel-site-protection)[ Packagist](https://packagist.org/packages/elic-dev/laravel-site-protection)[ RSS](/packages/elic-dev-laravel-site-protection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (9)Used By (0)

Very simple site wide password protection for Laravel5
======================================================

[](#very-simple-site-wide-password-protection-for-laravel5)

This will add a simple password form in front of your application to protected it from any access. The password is specified using the `.env` file to protect DEV or STAGE sites only.

You can use multiple passwords for different user groups. Once the password is removed, the access is revoked.

This does not protect any assets files like css or images.

**Looks like**

[![SiteProtection](https://raw.githubusercontent.com/elic-dev/laravel-site-protection/master/preview.png)](https://raw.githubusercontent.com/elic-dev/laravel-site-protection/master/preview.png)

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

[](#installation)

```
composer require elic-dev/laravel-site-protection

```

### Laravel &gt;= 5.2

[](#laravel--52)

This package requires at least the Laravel Framework of version **5.2**.

Add ServiceProvider to the providers array in `app/config/app.php`.

```
ElicDev\SiteProtection\SiteProtectionServiceProvider::class,

```

### Laravel &gt;= 5.5

[](#laravel--55)

You don't need to add this package to your `app/config/app.php` since it supports auto discovery.

### Add Middleware (Laravel &lt; 11.0)

[](#add-middleware-laravel--110)

Add Middleware to `app/Http/Kernel.php` or specific routes you want to protect.

```
protected $middlewareGroups = [
    'web' => [
        ...
        \ElicDev\SiteProtection\Http\Middleware\SiteProtection::class,
    ],
    ...
];

```

### Add Middleware (Laravel &gt;= 11.0)

[](#add-middleware-laravel--110-1)

Edit Middleware at `config/app.php` and include against the 'web' middleware.

```
 ->withMiddleware(function (Middleware $middleware) {
        $middleware->appendToGroup('web',\ElicDev\SiteProtection\Http\Middleware\SiteProtection::class);
    })

```

### Configuration

[](#configuration)

Most configuration can be done using ENV variables by adding the following keys to your `.env` file.

#### Adjusting the passwords

[](#adjusting-the-passwords)

You can use multiple passwords separated by comma.

```
SITE_PROTECTION_PASSWORDS=password1,password2

```

To revoke access to your site simply change the password. This requires every user using the old password to re-enter a password.

#### Exclude certain paths from protection

[](#exclude-certain-paths-from-protection)

You can exclude specific paths from protection. Add a comma seperated list of paths to your `.env` file. You can use the `*` to exclude a group of paths.

```
SITE_PROTECTION_EXCEPT_PATHS=path1,path2,login*

```

#### Protect only specific paths

[](#protect-only-specific-paths)

You can protect only some paths. Add a comma seperated list of paths to your `.env` file. You can use the `*` to protect a a group of paths.

```
SITE_PROTECTION_PROTECTED_ONLY_PATHS=path1,path2,admin*

```

#### Set a CSS file uri

[](#set-a-css-file-uri)

You can change the look and feel of the password protection page by adding an uri to your main css file. The css file is appened to the existing css styles to keep basic alignments.

```
SITE_PROTECTION_CSS_FILE_URI=/assets/app.css

```

#### Cookie lifetime

[](#cookie-lifetime)

Set the duration for the cookie lifetime in seconds. Default is set to one year. The following `.env` value would change it to one week:

```
SITE_PROTECTION_COOKIE_LIFETIME=604800

```

### Customization

[](#customization)

In case you really need to. You can modify the view that handles password entry by publishing the views to your resource folder. This is not recommended and might cause problems on future updates. Try using the uri to a css file first.

Run the following command:

```
php artisan vendor:publish --provider="ElicDev\SiteProtection\SiteProtectionServiceProvider" --tag=views

```

You can now make the changes in `resources/vendor/views/site-protection/site-protection-form.blade.php`.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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

Every ~320 days

Recently: every ~470 days

Total

8

Last Release

1042d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bd3f6d56c3cb45c6b733e9acfe6559dcb49939a948f0ee9631567fad194b7b0?d=identicon)[elic-dev](/maintainers/elic-dev)

---

Top Contributors

[![L1lle](https://avatars.githubusercontent.com/u/182834?v=4)](https://github.com/L1lle "L1lle (14 commits)")[![mabasic](https://avatars.githubusercontent.com/u/1839930?v=4)](https://github.com/mabasic "mabasic (2 commits)")[![BenQoder](https://avatars.githubusercontent.com/u/24754078?v=4)](https://github.com/BenQoder "BenQoder (1 commits)")[![ipridham](https://avatars.githubusercontent.com/u/7941207?v=4)](https://github.com/ipridham "ipridham (1 commits)")

---

Tags

laravellaravel-5-packagelaravel5-packagemiddleware

### Embed Badge

![Health badge](/badges/elic-dev-laravel-site-protection/health.svg)

```
[![Health](https://phpackages.com/badges/elic-dev-laravel-site-protection/health.svg)](https://phpackages.com/packages/elic-dev-laravel-site-protection)
```

PHPackages © 2026

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