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.

267PHPCI passing

Since Sep 9Pushed 6mo 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 today

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

20

—

LowBetter than 17% of packages

Maintenance47

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

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://www.gravatar.com/avatar/9b101844b491650ca48000b4c1490126bb44ce0a684ed37aad10b3096c2f6bd9?d=identicon)[nicoverbruggen](/maintainers/nicoverbruggen)

---

Top Contributors

[![nicoverbruggen](https://avatars.githubusercontent.com/u/3715845?v=4)](https://github.com/nicoverbruggen "nicoverbruggen (8 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

[firebase/php-jwt

A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.

9.8k435.8M1.8k](/packages/firebase-php-jwt)[league/oauth2-client

OAuth 2.0 Client Library

3.8k115.1M1.0k](/packages/league-oauth2-client)[google/auth

Google Auth Library for PHP

1.4k266.3M125](/packages/google-auth)[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k98.4M87](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99895.6M95](/packages/league-oauth1-client)[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k15.7M42](/packages/lab404-laravel-impersonate)

PHPackages © 2026

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