https://github.com/code16/privat
Password protect your in-development projects
https://github.com/code16/privat
demo laravel password-protection waitingpage
Last synced: 4 months ago
JSON representation
Password protect your in-development projects
- Host: GitHub
- URL: https://github.com/code16/privat
- Owner: code16
- License: mit
- Created: 2017-10-18T10:26:56.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2025-02-28T18:09:20.000Z (7 months ago)
- Last Synced: 2025-06-03T09:13:17.779Z (4 months ago)
- Topics: demo, laravel, password-protection, waitingpage
- Language: PHP
- Homepage:
- Size: 322 KB
- Stars: 13
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Privat
[](https://packagist.org/packages/code16/privat)
[](LICENSE.md)
[](https://github.com/code16/privat/actions/workflows/main.yml)
[](https://packagist.org/packages/code16/privat)Privat is a very simple password protection for Laravel projects. It's useful for websites in a staging state.

## Usage
### Install with composer
```sh
composer require code16/privat
```### Configure Privat via .env keys
```sh
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:
```sh
PRIVAT_MIDDLEWARE_GROUP=web,admin
```### Handle exceptions
You can exclude some hosts or URLs from Privat:
```sh
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:
```sh
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):
```sh
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