pickling
1.0.0
pickling是 PHP 扩展社区库以及 PHP 扩展和应用程序存储库 REST API 的简单但功能强大的客户端。
从本质上讲, pickling通过 HTTPlug Discovery 与许多 HTTP 客户端一起开箱即用。
换句话说,以下每一种实现都至少需要一个包:
向作曲家添加pickling :
composer require pecm/ pickling
HTTP 客户端的一般建议,使用 kriswallsmith/buzz 和 nyholm/psr7:
composer require kriswallsmith/buzz nyholm/psr7
除了下面的简单示例之外,还可以在示例/文件夹中找到更多用法示例。
工厂实例化
// pecl client with standard options
$ peclClient = pickling Factory:: createPecl ();
// pear client with standard options
$ pearClient = pickling Factory:: createPear ();
定制实例化
// pecl client
$ peclClient = new pickling Client (
// a class that implements pickling ChannelChannelInterface
new pickling Channel Pecl (),
// a class that implements PsrHttpClientClientInterface
new Http Client Socket Client (),
// a class that implements PsrHttpMessageRequestFactoryInterface
new Nyholm Psr7 Factory Psr17Factory (),
// a class that implements PsrHttpMessageStreamFactoryInterface
new Nyholm Psr7 Factory Psr17Factory ()
);
// pear client
$ pearClient = new pickling Client (
// a class that implements pickling ChannelChannelInterface
new pickling Channel Pear (),
// a class that implements PsrHttpClientClientInterface
new Http Client Socket Client (),
// a class that implements PsrHttpMessageRequestFactoryInterface
new Nyholm Psr7 Factory Psr17Factory (),
// a class that implements PsrHttpMessageStreamFactoryInterface
new Nyholm Psr7 Factory Psr17Factory ()
);
获取包裹清单
$ peclClient -> getPackageList ();
pickling Resource PackageList Object
(
[channel: pickling Resource PackageList :private] => " pecl.php.net "
[list: pickling Resource PackageList :private] => Array
(
[ 0 ] => " ahocorasick "
// ...
[ 408 ] => " zstd "
)
)
获取包发布列表
$ peclClient -> with ( ' amqp ' )-> getReleaseList ();
pickling Resource Package ReleaseList Object
(
[packageName: pickling Resource Package ReleaseList :private] => " amqp "
[channel: pickling Resource Package ReleaseList :private] => " pecl.php.net "
[list: pickling Resource Package ReleaseList :private] => Array
(
[ 0 ] => pickling Resource Package Release Version Object
(
[number: pickling Resource Package Release Version :private] => " 1.10.2 "
[stability: pickling Resource Package Release Version :private] => " stable "
)
// ...
[ 41 ] => pickling Resource Package Release Version Object
(
[number: pickling Resource Package Release Version :private] => " 0.1.0 "
[stability: pickling Resource Package Release Version :private] => " beta "
)
)
)
获取软件包最新版本
$ peclClient -> with ( ' amqp ' )-> getLatestVersion ();
" 1.10.2 "
获取包裹信息
$ peclClient -> with ( ' amqp ' )-> getInfo ();
pickling Resource Package Info Object
(
[packageName: pickling Resource Package Info :private] => " amqp "
[channel: pickling Resource Package Info :private] => " pecl.php.net "
[category: pickling Resource Package Info :private] => " Networking "
[license: pickling Resource Package Info :private] => " PHP License "
[licenseUri: pickling Resource Package Info :private] => ""
[summary: pickling Resource Package Info :private] => " Communicate with any AMQP compliant server "
[description: pickling Resource Package Info :private] => " This extension can communicate with any AMQP spec 0-9-1 compatible server, such as RabbitMQ, OpenAMQP and Qpid, giving you the ability to create and delete exchanges and queues, as well as publish to any exchange and consume from any queue. "
[packageReleasesLocation: pickling Resource Package Info :private] => ""
[parentPackage: pickling Resource Package Info :private] => ""
[packageReplaceBy: pickling Resource Package Info :private] => ""
[channelReplaceBy: pickling Resource Package Info :private] => ""
)
获取发布信息
$ peclClient -> with ( ' amqp ' )-> at ( ' 1.10.2 ' )-> getInfo ();
pickling Resource Package Release Info Object
(
[packageName: pickling Resource Package Release Info :private] => " amqp "
[channel: pickling Resource Package Release Info :private] => " pecl.php.net "
[version: pickling Resource Package Release Info :private] => " 1.10.2 "
[stability: pickling Resource Package Release Info :private] => " stable "
[license: pickling Resource Package Release Info :private] => " PHP License "
[releasingMaintainer: pickling Resource Package Release Info :private] => " lstrojny "
[summary: pickling Resource Package Release Info :private] => " Communicate with any AMQP compliant server "
[description: pickling Resource Package Release Info :private] => " This extension can communicate with any AMQP spec 0-9-1 compatible server, such as RabbitMQ, OpenAMQP and Qpid, giving you the ability to create and delete exchanges and queues, as well as publish to any exchange and consume from any queue. "
[releaseDate: pickling Resource Package Release Info :private] => " 2020-04-05 15:41:28 "
[releaseNotes: pickling Resource Package Release Info :private] => " - Windows build: avoid variable lengths arrays (Christoph M. Becker) (https://github.com/pdezwart/php-amqp/issues/368)
For a complete list of changes see:
https://github.com/pdezwart/php-amqp/compare/v1.10.1...v1.10.2 "
[releaseSize: pickling Resource Package Release Info :private] => 107350
[downloadUri: pickling Resource Package Release Info :private] => " https://pecl.php.net/get/amqp-1.10.2 "
[packageLink: pickling Resource Package Release Info :private] => ""
)
该库根据 MIT 许可证获得许可。