treblle/treblle-api-tools-laravel

一套用于在Laravel中构建API的有用工具。

0.0.1 2023-03-27 10:11 UTC

This package is auto-updated.

Last update: 2024-08-27 16:19:38 UTC


README

Latest Version PHP Version Tests Total Downloads MIT Licence

Treblle让理解您的API及其使用情况变得超级简单。只需将Treblle添加到您的API中,即可获得以下功能

  • 实时API监控和日志记录
  • 支持OAS的自动生成API文档
  • API分析
  • 质量评分
  • 一键测试
  • 移动API管理
  • 支持Laravel Vapor和Laravel Octane
  • 等等...

一套用于在Laravel中构建API的有用工具。

要求

  • PHP 8.2+
  • Laravel 10+

安装

composer require treblle/treblle-api-tools-laravel

使用

头部信息

授权

您可以使用以下方式使用Authorization头部:

use Treblle\Tools\Http\Enums\Headers\AuthScheme;
use Treblle\Tools\Http\Headers\Authorization;

$auth = new Authorization(
    type: AuthScheme::BEARER,
    credentials: 'YOUR_API_TOKEN_HERE',
);

// Turn the header into an array
$array = $auth->toArray();
//[
//    'type' => AuthScheme::BEARER,
//    'credentials' => 'YOUR_API_TOKEN_HERE'
//]

// Turn the header into a header
$header = $auth->toHeader();
//[
//    'Authorization' => 'Bearer YOUR_API_TOKEN_HERE',
//]

支持

如果您遇到任何问题,请随时通过https://treblle.com或电子邮件hello@treblle.com联系我们,我们将竭诚为您提供帮助。

许可证

版权所有 2022,Treblle Limited。根据MIT许可证授权:https://open-source.org.cn/licenses/mit-license.php