code16/machina-client

code16/machina 的客户端包

v3.4 2024-03-07 14:00 UTC

README

"code16/machina-client" 旨在用于实现与受 Code16/Machina JWT Token 认证保护 JSON API 通信的客户端。它是围绕 GuzzleHttp 的简单包装,并为您处理查询/刷新 JWT 令牌。

安装

    composer require code16/machina-client

使用方法

    $client = new \Code16\MachinaClient\MachinaClient;

    $client->setBaseUrl("https://example.com/api");
    $client->setCredentials([
        "client" => "some-client-key",
        "secret" => "some-secret-key",
    ]);

    try {
        $client->get("/foo");  // ['foo => bar'];
    }
    catch(\Code16\MachinaClient\Exceptions\InvalidCredentialsException $e) 
    {
        // Incorrect credentials
    }

许可证

(c) 2018 code16.fr

MIT