Download the PHP package jalallinux/laravel-shield without Composer
On this page you can find all versions of the php package jalallinux/laravel-shield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jalallinux/laravel-shield
More information about jalallinux/laravel-shield
Files in jalallinux/laravel-shield
Package laravel-shield
Short Description A HTTP basic auth middleware for Laravel
License MIT
Homepage https://github.com/jalallinux/laravel-shield
Informations about the package laravel-shield
🔑 Laravel Shield
A HTTP basic auth middleware for Laravel.
Installation
Require this package, with Composer, in the root directory of your project.
Add the middleware to the $routeMiddleware
array in your Kernel.php
file.
Configuration
Laravel Shield requires configuration. To get started, you'll need to publish all vendor assets:
This will create a config/shield.php
file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
HTTP Basic Auth Credentials
The user credentials which are used when logging in with HTTP basic authentication.
Usage
To protect your routes with the shield you can add it to the routes file.
You can also add the shield middleware to your controllers constructor.
The middleware accepts one optional parameter to specify which user credentials to compared with.
To add a new user, you probably want to use hashed credentials. Hashed credentials can be generated with the password_hash()
function in the terminal:
Then copy and paste the hashed credentials to the .env
environment file.