code16/privat

Simple private access package for Laravel.
49,372 13
Install
composer require code16/privat
Latest Version:v4.1.1
PHP:8.4.*|8.5.*
License:MIT
Last Updated:Apr 13, 2026
Links: GitHub  ·  Packagist
Maintainer: code16

Privat

Latest Version on Packagist MIT Licensed Tests Total Downloads

Privat is a very simple password protection for Laravel projects. It's useful for websites in a staging state.

Screenshot

Usage

Install with composer

composer require code16/privat

Configure Privat via .env keys

PRIVAT_ENABLED=true
PRIVAT_PASSWORD=mypassword

Advanced usage

Choose impacted middleware groups

By default, Privat will protect the web middleware group. If you want to impact other groups, you can tweak the corresponding .env key:

PRIVAT_MIDDLEWARE_GROUP=web,admin

Handle exceptions

You can exclude some hosts or URLs from Privat:

PRIVAT_EXCEPTED_URLS="/login,/admin"
PRIVAT_EXCEPTED_HOSTS="admin.mywebsite.com"

Waiting page

If you need to present a public waiting page, set the waiting page view name in the PRIVAT_WAITING_VIEW env key:

PRIVAT_WAITING_VIEW="demo.waiting"

From then, all requests without the Privat registration will be redirected to /privat_waiting which will render the configured view, except /privat, which will still present the Privat form.

Publish the config file

Of course, you can publish the config file instead of using env variables (even if we think it’s more convenient for such a tool):

php artisan vendor:publish --provider="Code16\Privat\PrivatServiceProvider"

How does it work

Quite simple: if the given password is correct, Privat sets a session property, and look for it on each request. So, obviously, Privat won't work on non session based systems (an API for instance).

License

MIT

Related Packages

laravel/pint

An opinionated code formatter for PHP.

190,686,302 3,164
tightenco/duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & c...

3,086,275 605
directorytree/ldaprecord-laravel

LDAP Authentication & Management for Laravel.

2,654,109 574
hemp/presenter

Easy Model Presenters in Laravel

636,598 247
juzaweb/cms

Juzaweb CMS is a Content Management System (CMS) developed based on Laravel Fram...

571,269 189