tacit / client
Tacit API 客户端库
dev-master
2016-01-12 05:45 UTC
Requires
- php: >=5.4
- flynsarmy/slim-monolog: ^1.0
- guzzlehttp/guzzle: ^5.0
- slim/slim: ^2.4
- slim/views: ^0.1.3
- twig/twig: ^1.18.0
Requires (Dev)
- phpunit/phpunit: ^4.5
This package is auto-updated.
Last update: 2024-09-14 08:48:15 UTC
README
Tacit 客户端项目是一个库,用于在 Slim 网络应用中使用 Tacit 创建的 RESTful API。
安装
使用 composer 需求 tacit\client
项目。
user@host:~$ composer require "tacit/client dev-master"
使用方法
在你的应用网关 PHP 文件中,将 Identities 提供者和 API 客户端作为单例添加到 DI 容器
$app->container->singleton('identities', function() use ($app) { return (new \Tacit\Client\Identity($app->config('api.identities'))); }); $app->container->singleton('api', function() use ($app) { return (new \Tacit\Client($app, $app->config('api.endpoint'))); });
然后添加 Session 中间件到应用
session_name($app->config('session.name')); session_set_cookie_params( (integer)$app->config('session.lifetime'), rtrim($app->request->getRootUri(), '/') . '/' ); $app->add(new \Tacit\Middleware\Session());