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 8mo 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 1mo 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

19

—

LowBetter than 10% of packages

Maintenance43

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

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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