2017 © Pedro Peláez
 

project privat

Simple private access package for Laravel.

image

dvlpp/privat

Simple private access package for Laravel.

  • Thursday, November 9, 2017
  • by dvlpp
  • Repository
  • 2 Watchers
  • 5 Stars
  • 2,451 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

This package is deprecated, a backward compatible v2 version of it is available here: code16/privat, (*1)

Privat

Private is a very simple password protection for Laravel projects. It's useful for websites in a staging state., (*2)

Screenshot, (*3)

Usage

Install with composer

composer require dvlpp/privat, (*4)

Add Privat Service Provider (except for Laravel 5.5+)

Add the following line in the providers section of your config/app.php file:, (*5)

\Dvlpp\Privat\PrivatServiceProvider::class, (*6)

Add Privat middleware in your project

Add the following line at the end of the $middleware array of the app/Http/Kernel file:, (*7)

\Dvlpp\Privat\PrivatMiddleware::class, (*8)

Set Privat config

First create the privat config file:, (*9)

php artisan vendor:publish --provider="Dvlpp\Privat\PrivatServiceProvider", (*10)

And then edit the new /config/privat.php accordingly (nothing fancy), or even better, add this keys in your .env file:, (*11)

  • 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)., (*12)

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)., (*13)

License

WTFPL, (*14)

The Versions