承接 skulich/laravel-clavis 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

skulich/laravel-clavis

最新稳定版本:1.1.1

Composer 安装命令:

composer require skulich/laravel-clavis

包简介

Laravel Clavis is a lightweight token-based authentication middleware package for Laravel APIs

README 文档

README

Latest Version on Packagist PHP Version Require Laravel Version Run Tests Code Coverage License Total Downloads

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

Generate Token

Generate a new API token via CLI.

The generated token is shown only once. Store it securely and share it over a safe channel.

php artisan clavis:token

Rotate Token

Run the same command to rotate the token. The old token will stop working immediately after regeneration.

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');
})

Failed Auth Events

Failed authentication attempts dispatch Illuminate\Auth\Events\Failed with guard clavis and a masked token.

Event::listen(Failed::class, function (Failed $event) {
    if ($event->guard === 'clavis') {
        Log::warning('Clavis: unauthorized request', $event->credentials);
    }
});

Nota Bene

  • CLAVIS_HASH is a secret, treat it like APP_KEY — never commit it to version control.
  • For internet-facing endpoints, apply Laravel's throttle middleware alongside clavis to mitigate brute-force attacks.

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.

统计信息

  • 总下载量: 269
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固