skulich / laravel-clavis
Laravel Clavis is a lightweight token-based authentication middleware package for Laravel APIs
1.0.0
2026-01-02 15:07 UTC
Requires
- php: ^8.3
- laravel/framework: ^12.42.0
Requires (Dev)
- larastan/larastan: ^3.8
- laravel/pint: ^1.26
- orchestra/testbench: ^10.8
- pestphp/pest: ^4.1
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-type-coverage: ^4.0
- phpstan/extension-installer: ^1.4
- rector/rector: ^2.2
- symfony/var-dumper: ^7.4
README
Laravel Clavis is a lightweight token-based authentication middleware package for Laravel APIs.
Perfect for API-first applications and microservices where you need simple and secure token-based authentication without the overhead of Sanctum.
Key benefits:
- ๐ Quick Setup: Create a token via CLI
- ๐ Secure: Built on Laravel's native Hash generator
- ๐ฏ Focused: Designed for server-to-server scenarios
- ๐งน Clean: No migrations, No users, No dependencies
Table of contents
Installation
Install the package via Composer.
composer require skulich/laravel-clavis
Usage
CLI Command
Create a new API token via CLI.
php artisan clavis:token
API Middleware
Add the clavis middleware to your API routes.
// Per Route
Route::get('/test', function (Request $request) {
// return ...
})->middleware('clavis');
// Per Group
Route::middleware('clavis')->group(function () {
// Route:: ...
});
// Globally in app/bootstrap/app.php
->withMiddleware(function (Middleware $middleware): void {
$middleware->appendToGroup('api', 'clavis');
})
Tests
Run the entire test suite:
composer test
Changelog
Please see CHANGELOG for more information.
Contributing
Please see CONTRIBUTING for more information.
License
The MIT License (MIT). Please see LICENSE for more information.