azzarip/api-basic-auth
最新稳定版本:1.1.1
Composer 安装命令:
composer require azzarip/api-basic-auth
包简介
Basic auth system for intraserver api communication
README 文档
README
This package enables secure API communication between two Laravel applications using HTTP Basic Authentication.
Install the package on both applications that need to communicate.
In your .env or config/services.php, define the following:
-
Inbound Password
Used to authenticate incoming API requests from the other server. -
Outbound Password
Used when this application sends outgoing API requests to the other server. -
Endpoint
The full URL of the other server (e.g.,https://api.example.com).
Installation
You can install the package via composer:
composer require azzarip/api-basic-auth
In the config/services.php add the following
'username' => [ 'endpoint' => 'http....' //full url for calls 'inbound_password' => env('INBOUND_PASSWORD'), 'outbound_password' => env('OUTBOUND_PASSWORD'), ]
You can define multiple username each of them with endpoint and inbound and outbound password.
Usage
Inbound Requests
For the inbound request use the api.auth middleware, followed by the username as specified in the config file.
Route::get('/api')->middleware('api.auth:username');
This middleware will let all the request with username username and password inbound_password, as specified in the config files.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-05