2017 © Pedro Peláez
 

project privat

Simple private access package for Laravel.

image

code16/privat

Simple private access package for Laravel.

  • Wednesday, June 6, 2018
  • by code16
  • Repository
  • 2 Watchers
  • 6 Stars
  • 3,485 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 4 Versions
  • 110 % Grown

The README.md

Privat

Latest Version on Packagist MIT Licensed Tests Total Downloads, (*1)

Privat 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 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:, (*4)

PRIVAT_MIDDLEWARE_GROUP=web,admin

Handle exceptions

You can exclude some hosts or URLs from Privat:, (*5)

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:, (*6)

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

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):, (*8)

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

License

MIT, (*10)

The Versions