samuel4x4/chefauth-guzzle-plugin

一个处理Chef服务器API所有身份验证的Guzzle(v3)插件。

安装: 4

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 2

类型:symfony-bundle

1.0.1 2015-03-24 22:05 UTC

This package is auto-updated.

Last update: 2024-09-14 03:00:33 UTC


README

一个处理Chef服务器API所有身份验证的Guzzle(v3)插件。

需求

  • PHP 5.3
  • Guzzle 3

安装

首先,您当然需要Guzzle。

leaseweb/chefauth-guzzle-plugin作为依赖项添加到您的项目中

$ php composer.phar require "leaseweb/chefauth-guzzle-plugin":"1.0.0"

Composer将插件安装到您的项目的vendor/leaseweb目录。

现在您可以使用该插件了。

使用方法

创建一个新的指向您的Chef服务器的Guzzle客户端

// Supply your client name and location of the private key.
$chefAuthPlugin = new \LeaseWeb\ChefGuzzle\Plugin\ChefAuth\ChefAuthPlugin("client-name", "/tmp/client-name.pem");

// Create a new guzzle client
$client = new \Guzzle\Http\Client('https://manage.opscode.com');
$client->addSubscriber($chefAuthPlugin);


// Now you can make calls to the chef server
$response = $client->get('/organizations/my-organization/nodes')->send();

$nodes = $response->json();

有关Guzzle的更多信息,请参阅http://guzzle3.readthedocs.org/docs.html

许可证

MIT