| Laravel | PHP | Testbench |
|---|---|---|
| 11.15+ | 8.2+ | 9.x |
| 12.x | 8.2+ | 10.x |
| 13.x | 8.3+ | 11.x |
composer require eloquent-works/exilePublish configuration and migrations:
php artisan exile:installPublish and migrate:
php artisan exile:install --migratePublish the customizable mail templates too:
php artisan exile:install --migrate --viewsUse --force only when intentionally replacing already-published files:
php artisan exile:install --force --viewsResources may also be published separately:
php artisan vendor:publish --tag=exile-config
php artisan vendor:publish --tag=exile-migrations
php artisan vendor:publish --tag=exile-views<?php
namespace App\Models;
use EloquentWorks\Exile\Traits\Bannable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Bannable;
}The trait provides relationships and convenience methods for bans, restrictions, warnings, strikes, and device observations.
Generate a 32-byte key:
php -r "echo 'base64:'.base64_encode(random_bytes(32)).PHP_EOL;"Add it to .env:
EXILE_HASH_KEY=base64:generated-valueChanging the key later prevents existing IP and device hashes from matching newly calculated values.
Route::middleware(['auth', 'exile'])->group(function (): void {
Route::get('/dashboard', DashboardController::class);
});Route::post('/posts', StorePostController::class)
->middleware([
'auth',
'exile',
'exile.allowed:posting',
]);The bundled ban notifications implement ShouldQueue. When notifications are enabled, configure a queue connection and run a worker:
php artisan queue:workFor local development, sync may be used, but an asynchronous queue is recommended in production.
The consuming application must run Laravel's scheduler:
* * * * * cd /path/to/application && php artisan schedule:run >> /dev/null 2>&1During local development:
php artisan schedule:workContinue with Configuration.