larva / easysdk
Easy SDK
1.2.4
2023-11-21 03:43 UTC
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^6.2 || ^7.0
- monolog/monolog: ^2.2
- pimple/pimple: ^3.0
- psr/simple-cache: ^1.0 || ^2.0 || ^3.0
- symfony/cache: ^5.4 || ^6.0
- symfony/event-dispatcher: ^5.4 || ^6.0
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/psr-http-message-bridge: ^2.1.2
Requires (Dev)
README
抽取移植 EasyWechat 核心,去除无用模块,使其可以支持其他类型 SDK,作为第三方其他类型 HTTP SDK 的基包。
Installation
composer require larva/easysdk -vv
Usage
$options = [ //Http 配置 'http' => [ 'max_retries' => 1,//失败重试次数 'retry_delay' => 500,//重试延迟 //'log_template' => '>>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}',//日志模板 ], // 日志配置 'log' => [ 'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod 'channels' => [ // 测试环境 'dev' => [ 'driver' => 'single', 'path' => 'easysdk.log', 'level' => 'debug', ], // 生产环境 'prod' => [ 'driver' => 'daily', 'path' => 'easysdk.log', 'level' => 'info', ], ], ], ]; $app = new \Larva\EasySDK\ServiceContainer($options); // 一般是 继承 \Larva\EasySDK\ServiceContainer 类来扩展出API