dvlpp / privat
Simple private access package for Laravel.
Installs: 3 084
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 2
Open Issues: 0
Type:project
Requires
- php: >=5.5.9
- laravel/framework: 5.2.*|5.3.*|5.4.*|5.5.*
Requires (Dev)
- laravel/browser-kit-testing: ~1.0
- laravel/laravel: 5.2.*|5.3.*|5.4.*|5.5.*
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~5.0
- symfony/css-selector: 2.8.*|3.0.*
- symfony/dom-crawler: 2.8.*|3.0.*
This package is not auto-updated.
Last update: 2020-01-23 17:26:40 UTC
README
This package is deprecated, a backward compatible v2 version of it is available here: code16/privat
Privat
Private is a very simple password protection for Laravel projects. It's useful for websites in a staging state.
Usage
Install with composer
composer require dvlpp/privat
Add Privat Service Provider (except for Laravel 5.5+)
Add the following line in the providers
section of your config/app.php
file:
\Dvlpp\Privat\PrivatServiceProvider::class
Add Privat middleware in your project
Add the following line at the end of the $middleware
array of the app/Http/Kernel
file:
\Dvlpp\Privat\PrivatMiddleware::class
Set Privat config
First create the privat config file:
php artisan vendor:publish --provider="Dvlpp\Privat\PrivatServiceProvider"
And then edit the new /config/privat.php
accordingly (nothing fancy),
or even better, add this keys in your .env
file:
- PRIVAT_RESTRICTED=true
- PRIVAT_PASSWORD=mypassword
Exceptions
The except
config param is meant to contain an array of excluded urls
(those url won't be protected by Privat).
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).