komtcho / shot
构建HTTP请求的类
dev-main
2023-01-28 22:37 UTC
This package is not auto-updated.
Last update: 2024-09-26 02:31:47 UTC
README
通过封装类调用HTTP请求
示例:
<?php use Komtcho\Shot\Contracts\ShootingGet; use Komtcho\Shot\Contracts\WithHeaders; use Komtcho\Shot\Shooting; class Request extends Shooting implements WithHeaders, ShootingGet { protected $url = 'https://webhook.site/9148264c-19c9-4c35-b0f9-0d71cdec3c9d'; public function headers(): array { return [ 'X-First' => 'foo', 'X-Second' => 'bar', ]; } public function query(): array { return []; } } // Calling $request = new Request; return $request->call();