daikazu/simple-token-middleware

A simple token middleware

v1.0.0 2019-03-19 01:48 UTC

README

Build Status styleci

Packagist Packagist Packagist

Small package to quickly add custom middleware to your laravel app to easily restrict access to your routes.

Installation

Install via composer

composer require daikazu/simple-token-middleware

Register Service Provider

Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.

Add service provider to config/app.php in providers section

Daikazu\SimpleTokenMiddleware\ServiceProvider::class,

Register Facade

Register package facade in config/app.php in aliases section

Daikazu\SimpleTokenMiddleware\Facades\SimpleTokenMiddleware::class,

Publish Configuration File

php artisan vendor:publish --provider="Daikazu\SimpleTokenMiddleware\ServiceProvider" --tag="config"

Usage

Add SIMPLE_TOKEN=my_secret_token to your .env file,

use the middleware name simple.token in your route assignment.


Route::post('/api/my-protected-route', 'Controller@index')->middleware('simple.token');

Security

If you discover any security related issues, please email instead of using the issue tracker.

Credits

This package is bootstrapped with the help of melihovv/laravel-package-generator.