PHPackages                             mylonia/site-guard - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mylonia/site-guard

ActiveLaravel-package[Authentication &amp; Authorization](/categories/authentication)

mylonia/site-guard
==================

Guard your website from visitors by requiring a password.

276PHPCI passing

Since May 31Pushed 3w agoCompare

[ Source](https://github.com/Mylonia/site-guard)[ Packagist](https://packagist.org/packages/mylonia/site-guard)[ RSS](/packages/mylonia-site-guard/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Site Guard
==========

[](#site-guard)

Protect your site from random visitors with a simple plain-text password guard, configurable in your `.env` file.

Apply the middleware to your service provider of choice, and this package will prevent visiting all routes by default. Instead, a password prompt will be displayed:

[![A simple password prompt.](screenshot.png)](screenshot.png)

It is possible to customize the password page, and to customize which routes are accessible regardless of Site Guard's activation status.

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

[](#installation)

You can install the package with `composer`:

```
composer require mylonia/site-guard
```

Usage
-----

[](#usage)

### Configuring a password

[](#configuring-a-password)

First, set these environment variables:

```
SITE_GUARD_PASSWORD=your-passphrase-here
```

### Registering the middleware

[](#registering-the-middleware)

You can register the middleware under the conditions of your liking, for example in `AppServiceProvider`:

```
use Mylonia\SiteGuard\SiteGuardMiddleware;

public function boot(Router $router): void
{
    if (! $this->app->environment('production')) {
        $router->pushMiddlewareToGroup('web', SiteGuardMiddleware::class);
    }
}
```

This ensures that the production website is unaffected, but any potential `local` or `staging` setup will display the message. You can tweak this as desired.

### Publishing assets

[](#publishing-assets)

You can also exclude particular routes by customising the `config` file.

```
php artisan vendor:publish --provider="Mylonia\SiteGuard\SiteGuardServiceProvider"
```

This will publish the custom `views` and the `site-guard` config file. You can further customise the configuration file this way.

For example, you can adapt `excluded_routes` to exclude particular routes. By default, all `site_guard.*` routes are excluded, but you can add more this way. (You can use wildcards.)

You can also customise which middleware is required to run when the Site Guard routes are visited, which may be necessary depending on your project.

Testing
-------

[](#testing)

To run the test suite:

```
composer test
```

To run all steps (including linting, static checks, etc.) please run:

```
composer verify
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please get in touch with  to report a vulnerability.

Credits
-------

[](#credits)

- [Nico Verbruggen](https://github.com/nicoverbruggen)
- [All Contributors](https://github.com/mylonia/site-guard/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance62

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3715845?v=4)[Nico Verbruggen](/maintainers/nicoverbruggen)[@nicoverbruggen](https://github.com/nicoverbruggen)

---

Top Contributors

[![nicoverbruggen](https://avatars.githubusercontent.com/u/3715845?v=4)](https://github.com/nicoverbruggen "nicoverbruggen (9 commits)")

### Embed Badge

![Health badge](/badges/mylonia-site-guard/health.svg)

```
[![Health](https://phpackages.com/badges/mylonia-site-guard/health.svg)](https://phpackages.com/packages/mylonia-site-guard)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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