Looking to hire Laravel developers? Try LaraJobs

laravel-release-protection maintained by yaroslawww

Description
Protect your routes for not allowed users.
Last update
2023/08/20 09:07 (dev-main)
License
Downloads
31

Comments
comments powered by Disqus

Laravel: release protection

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Protect your routes for not allowed users.

Installation

Install the package via composer:

composer require think.studio/laravel-release-protection

You can publish the config file with:

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

Configuration in .env (optional)

RPROTECT_TESTERS_EMAILS="myemail@test.com,otheremail@test.com"
RPROTECT_FIRST_PARTY_IPS="123.4.5.6,123.4.5.7"

Usage

Add new middlewares

# app/Http/Kernel.php
protected $routeMiddleware = [
    // ...
    'first-party-ip'          => \ReleaseProtection\Http\Middleware\VerifyFirstPartyClientIp::class,
    'testers-email'           => \ReleaseProtection\Http\Middleware\TestersEmailMiddleware::class,
];

Add middleware to routes

Route::middleware([ 'auth', 'testers-email:auth' ])
     ->group(function () {
     // 
     });
Route::get( 'my/events', \App\Http\Controllers\Events::class )
             ->middleware( [ 'first-party-ip:events' ] );

Credits

  • Think Studio