laravel-littlegatekeeper
, (*1)
Protect pages from access with a universal username/password combination (set by configuration)., (*2)
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*3)
Support us
, (*4)
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products., (*5)
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall., (*6)
Postcardware
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using., (*7)
Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium., (*8)
The best postcards will get published on the open source page on our website., (*9)
Install
You can install the package via Composer:, (*10)
$ composer require spatie/laravel-littlegatekeeper
Start by registering the package's the service provider:, (*11)
// config/app.php (L5)
'providers' => [
// ...
'Spatie\LittleGateKeeper\LittleGateKeeperServiceProvider',
],
Next, publish the config files:, (*12)
$ php artisan vendor:publish --provider="Spatie\LittleGateKeeper\LittleGateKeeperServiceProvider" --tag="config"
Finally, register the middleware:, (*13)
// app/Http/Kernel.php
protected $routeMiddleware = [
// ...
'littlegatekeeper' => \Spatie\LittleGateKeeper\AuthMiddleware::class,
];
Usage
First set up the username and password in your configuration file or .env file, (*14)
In your .env file add:, (*15)
// ...
GATEKEEPER_USERNAME=Choose_your_username
GATEKEEPER_PASSWORD=Choose_your_secret_password
You can protect your routes by applying the middleware:, (*16)
Route::get('/', ['middleware' => 'littlegatekeeper', function () {
return view('protectedpage');
}]);
If a user isn't logged in, he will be redirected to the url set in the config file (littlegatekeeper.authRoute)., (*17)
Authenticator methods
/**
* @param array $credentials Format: ['username' => '...', 'password' => '...']
* @return bool
*/
public function attempt($credentials)
/**
* @return bool
*/
public function isAuthenticated()
protected function logout()
Change log
Please see CHANGELOG for more information what has changed recently., (*18)
Contributing
Please see CONTRIBUTING for details., (*19)
Security
If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker., (*20)
Credits
About Spatie
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*21)
License
The MIT License (MIT). Please see License File for more information., (*22)