apitoolkit / apitoolkit-symfony
APIToolkit 的 PHP/Symfony SDK 包装器。它监控传入流量,收集请求并将请求发送到 apitoolkit 服务器。
dev-master
2024-07-04 10:26 UTC
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- galbar/jsonpath: ^3.0
- google/cloud-pubsub: >=1.35
- symfony/dependency-injection: >=5.4
- symfony/http-kernel: >=5.4
Requires (Dev)
- symfony/test-pack: dev-main
This package is auto-updated.
Last update: 2024-09-04 10:46:58 UTC
README
SDK
APItoolkit 是一款面向工程师和客户支持团队的端到端 API 和网络服务管理工具集。要将您的 Symfony(PHP)应用程序与 APItoolkit 集成,您需要使用此 SDK 来监控传入流量、聚合请求,并将它们发送到 APItoolkit 服务器。
目录
安装
请运行以下命令以安装 SDK
composer require apitoolkit/apitoolkit-symfony
配置
首先,将环境变量 APITOOLKIT_KEY
添加到您的 .env
文件中,如下所示
APITOOLKIT_KEY={ENTER_YOUR_API_KEY_HERE}
然后,将 APIToolkit\EventSubscriber\APIToolkitService
监听器和 API 密钥添加到您的 config/service.yaml
文件中,如下所示
# This file is the entry point to configure your own services. # Files in the packages/ subdirectory configure your dependencies. # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com.cn/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: locale: 'en' services: # default configuration for services in *this* file _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. APIToolkit\EventSubscriber\APIToolkitService: arguments: $apiKey: '%env(APITOOLKIT_KEY)%' # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App\: resource: '../src/' exclude: - '../src/DependencyInjection/' - '../src/Entity/' - '../src/Kernel.php' # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones
注意
示例字符串 {ENTER_YOUR_API_KEY_HERE}
应替换为从 APItoolkit 控制台生成的 API 密钥。
重要
要了解有关配置选项的更多信息(字段编辑、错误报告、出站请求等),请阅读此 SDK 文档。
贡献和帮助
要为此 SDK 贡献或从社区和我们的团队请求帮助,请执行以下任何一项
- 阅读我们的 贡献指南。
- 加入我们的社区 Discord 服务器。
- 在此存储库中创建 新问题。
许可证
此存储库在 MIT 许可下发布。