PHPackages                             stauth/laravel-stauth - 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. stauth/laravel-stauth

ActiveLibrary

stauth/laravel-stauth
=====================

Staging server athorization package, .htaccess alternative

0.0.7(8y ago)11.2kMITPHP

Since May 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/stauth/laravel-stauth)[ Packagist](https://packagist.org/packages/stauth/laravel-stauth)[ RSS](/packages/stauth-laravel-stauth/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (4)Versions (8)Used By (0)

Laravel Stauth
==============

[](#laravel-stauth)

[![Latest Stable Version](https://camo.githubusercontent.com/fbf7116a22d29d72d3549287b00aeae5bcd809c27cc090b66416dc8d5cfbada8/68747470733a2f2f706f7365722e707567782e6f72672f7374617574682f6c61726176656c2d7374617574682f76657273696f6e)](https://packagist.org/packages/stauth/laravel-stauth)[![Total Downloads](https://camo.githubusercontent.com/235cdf0f0c1cf3d3b7f3d59c4a9036815bea3141b677aaa387d2077d484a0099/68747470733a2f2f706f7365722e707567782e6f72672f7374617574682f6c61726176656c2d7374617574682f646f776e6c6f616473)](https://packagist.org/packages/stauth/laravel-stauth)[![License](https://camo.githubusercontent.com/08afc119fbe2acd27afff36cdafa0c689d0b4150fb19f9f43b3bcdaac6d4b2e6/68747470733a2f2f706f7365722e707567782e6f72672f7374617574682f6c61726176656c2d7374617574682f6c6963656e7365)](https://packagist.org/packages/stauth/laravel-stauth)[![composer.lock available](https://camo.githubusercontent.com/ab1efbf3c7fb4f8d6b0235f527f8d45b7cf35751d9bd71be2c08cfd535a1af66/68747470733a2f2f706f7365722e707567782e6f72672f7374617574682f6c61726176656c2d7374617574682f636f6d706f7365726c6f636b)](https://packagist.org/packages/stauth/laravel-stauth)

Staging server athorization package, alternative for .htaccess, register at [stauth.io](https://www.stauth.io/)

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

[](#installation)

```
composer require stauth/laravel-stauth
```

### Local and staging

[](#local-and-staging)

If you don't want Stauth service provider to be exeuted at production environment, create `StauthProtectionServiceProvider`

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Stauth\StauthServiceProvider;

class StauthProtectionServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if ($this->app->environment('local', 'staging')) {
            $this->app->register(StauthServiceProvider::class);
        }
    }
}
```

And add it to `config/app.php` below `AppServiceProvider`:

```
'providers' => [

        /**
         * Stauth app access protection
         */
        App\Providers\StauthProtectionServiceProvider::class,
],
```

### Production

[](#production)

If you don't mind Stauth service provider being executed at production environment, or you want to protect your production env, add it directly at `providers` array in `config/app.php`.

```
'providers' => [

        /**
         * Staging access control
         */
        Stauth\StauthServiceProvider::class,
],
```

Add Stauth middleware in `app/Http/Kernel.php`, it is **very important** that `StauthProtection` is **above** any response cache extension middleware like laravel-responsecache:

```
    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [

        'web' => [
            ...
            \Stauth\Middleware\StauthProtection::class,
    ],
```

Generate access token at [stauth.io](https://www.stauth.io) and add it as a `STAUTH_ACCESS_TOKEN` param in `.env` file:

```
STAUTH_ACCESS_TOKEN=verylongchainoflettersmixedwithsomerandomnumbers123
```

By default protected environment is `staging`, in order to change this, add `STAUTH_PROTECTED_ENV` param in `.env` file:

```
STAUTH_PROTECTED_ENV=local
```

Other
-----

[](#other)

If you want to know or do more, read below.

### Publish configuration

[](#publish-configuration)

You can publish configuration and update required params in php file:

```
php artisan vendor:publish --provider="Stauth\StauthServiceProvider" --tag=config
```

### Cache

[](#cache)

Please keep in mind that this package takes adventage of `csrf_token`, therefore it is important to exclude both routes `/stauth/protected` and `/stauth/authorize` from any response caching engines.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~42 days

Total

7

Last Release

3109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cd8b978cd18bf6adafd1074f0b45c88ea36acd94ba0452e2e19b06ecbe7906a?d=identicon)[lchachurski](/maintainers/lchachurski)

---

Top Contributors

[![lchachurski](https://avatars.githubusercontent.com/u/3366227?v=4)](https://github.com/lchachurski "lchachurski (14 commits)")

### Embed Badge

![Health badge](/badges/stauth-laravel-stauth/health.svg)

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

###  Alternatives

[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)

PHPackages © 2026

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