vdhoangson/laravel-api-auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

vdhoangson/laravel-api-auth

最新稳定版本:v1.0

Composer 安装命令:

composer require vdhoangson/laravel-api-auth

包简介

Laravel Api Authentication

README 文档

README

A simple Laravel package for API authentication using custom client credentials via headers.

Installation

  1. Install the package
composer require vdhoangson/laravel-api-auth
  1. Register the Service Provider (if not auto-discovered)

Add to bootstrap/providers.php:

(This package autoload provider)

Vdhoangson\LaravelApiAuth\LaravelApiAuthServiceProvider::class,
  1. Publish config and run migrations
php artisan vendor:publish --tag=laravel-api-auth-config
php artisan migrate
  1. Add data to the api_clients table

Create a record with the fields: name, client, client_secret.

  1. Use the middleware in your routes
Route::middleware('client-auth')->get('/test', function () {
    return response()->json(['message' => 'Authenticated!']);
});
  1. Send a test request

Send a request with the following headers:

  • X-Client
  • X-Client-Secret

Example:

curl -H "X-Client: your_client" -H "X-Client-Secret: your_secret" http://your-app.local/api/test

Funding

If you find this package helpful, you can support the author via GitHub Sponsors:

github.com/sponsors/vdhoangson

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-06-05