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 許可證獲得許可。