think.studio/laravel-release-protection

Protect your routes for not allowed users.

1.1.0 2023-08-20 07:07 UTC

This package is auto-updated.

Last update: 2024-11-20 09:59:28 UTC


README

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