mcmatters / ticl
轻量级 HTTP 客户端
v0.4.2
2023-10-22 17:13 UTC
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
README
安装
composer require mcmatters/ticl
使用方法
<?php declare(strict_types=1); require 'vendor/autoload.php'; $client = new \McMatters\Ticl\Client(); try { $response = $client->get('http://example.com/api/user?token=test'); $user = $response->json(); } catch (\McMatters\Ticl\Exceptions\RequestException $e) { $error = $e->asJson(); } catch (\Throwable $e) { $error = $e->getMessage(); }
注意
如果您需要更可定制的功能,请使用 Guzzle