项目作者: pecm

项目描述 :
A REST API Client for PECL and PEAR
高级语言: PHP
项目地址: git://github.com/pecm/pickling.git
创建时间: 2021-01-26T00:13:35Z
项目社区:https://github.com/pecm/pickling

开源协议:MIT License

下载


Pickling Maintainability Total Downloads

Pickling is a simple yet powerful client for PHP Extension Community Library and PHP Extension
and Application Repository
REST APIs.

Installation

At the core, Pickling works out-of-the-box with many HTTP Clients through HTTPlug Discovery.

In other words, it requires at least one package for each of the following implementations:

  1. psr/http-client-implementation
  2. psr/http-factory-implementation
  3. psr/http-message-implementation

To add Pickling to composer:

  1. composer require pecm/pickling

A general suggestion for HTTP Client, using kriswallsmith/buzz
and nyholm/psr7:

  1. composer require kriswallsmith/buzz nyholm/psr7

Usage

More usage examples beyond the simple ones below can be found on the examples/ folder.

Factory Instantiation

  1. // pecl client with standard options
  2. $peclClient = Pickling\Factory::createPecl();
  3. // pear client with standard options
  4. $pearClient = Pickling\Factory::createPear();

Customized Instantiation

  1. // pecl client
  2. $peclClient = new Pickling\Client(
  3. // a class that implements Pickling\Channel\ChannelInterface
  4. new Pickling\Channel\Pecl(),
  5. // a class that implements Psr\Http\Client\ClientInterface
  6. new Http\Client\Socket\Client(),
  7. // a class that implements Psr\Http\Message\RequestFactoryInterface
  8. new Nyholm\Psr7\Factory\Psr17Factory(),
  9. // a class that implements Psr\Http\Message\StreamFactoryInterface
  10. new Nyholm\Psr7\Factory\Psr17Factory()
  11. );
  12. // pear client
  13. $pearClient = new Pickling\Client(
  14. // a class that implements Pickling\Channel\ChannelInterface
  15. new Pickling\Channel\Pear(),
  16. // a class that implements Psr\Http\Client\ClientInterface
  17. new Http\Client\Socket\Client(),
  18. // a class that implements Psr\Http\Message\RequestFactoryInterface
  19. new Nyholm\Psr7\Factory\Psr17Factory(),
  20. // a class that implements Psr\Http\Message\StreamFactoryInterface
  21. new Nyholm\Psr7\Factory\Psr17Factory()
  22. );

Client

Get Package List

  1. $peclClient->getPackageList();
  2. Pickling\Resource\PackageList Object
  3. (
  4. [channel:Pickling\Resource\PackageList:private] => "pecl.php.net"
  5. [list:Pickling\Resource\PackageList:private] => Array
  6. (
  7. [0] => "ahocorasick"
  8. // ...
  9. [408] => "zstd"
  10. )
  11. )

Package

Get Package Release List

  1. $peclClient->with('amqp')->getReleaseList();
  2. Pickling\Resource\Package\ReleaseList Object
  3. (
  4. [packageName:Pickling\Resource\Package\ReleaseList:private] => "amqp"
  5. [channel:Pickling\Resource\Package\ReleaseList:private] => "pecl.php.net"
  6. [list:Pickling\Resource\Package\ReleaseList:private] => Array
  7. (
  8. [0] => Pickling\Resource\Package\Release\Version Object
  9. (
  10. [number:Pickling\Resource\Package\Release\Version:private] => "1.10.2"
  11. [stability:Pickling\Resource\Package\Release\Version:private] => "stable"
  12. )
  13. // ...
  14. [41] => Pickling\Resource\Package\Release\Version Object
  15. (
  16. [number:Pickling\Resource\Package\Release\Version:private] => "0.1.0"
  17. [stability:Pickling\Resource\Package\Release\Version:private] => "beta"
  18. )
  19. )
  20. )

Get Package Latest Release

  1. $peclClient->with('amqp')->getLatestVersion();
  2. "1.10.2"

Get Package Info

  1. $peclClient->with('amqp')->getInfo();
  2. Pickling\Resource\Package\Info Object
  3. (
  4. [packageName:Pickling\Resource\Package\Info:private] => "amqp"
  5. [channel:Pickling\Resource\Package\Info:private] => "pecl.php.net"
  6. [category:Pickling\Resource\Package\Info:private] => "Networking"
  7. [license:Pickling\Resource\Package\Info:private] => "PHP License"
  8. [licenseUri:Pickling\Resource\Package\Info:private] => ""
  9. [summary:Pickling\Resource\Package\Info:private] => "Communicate with any AMQP compliant server"
  10. [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."
  11. [packageReleasesLocation:Pickling\Resource\Package\Info:private] => ""
  12. [parentPackage:Pickling\Resource\Package\Info:private] => ""
  13. [packageReplaceBy:Pickling\Resource\Package\Info:private] => ""
  14. [channelReplaceBy:Pickling\Resource\Package\Info:private] => ""
  15. )

Package Release

Get Release Info

  1. $peclClient->with('amqp')->at('1.10.2')->getInfo();
  2. Pickling\Resource\Package\Release\Info Object
  3. (
  4. [packageName:Pickling\Resource\Package\Release\Info:private] => "amqp"
  5. [channel:Pickling\Resource\Package\Release\Info:private] => "pecl.php.net"
  6. [version:Pickling\Resource\Package\Release\Info:private] => "1.10.2"
  7. [stability:Pickling\Resource\Package\Release\Info:private] => "stable"
  8. [license:Pickling\Resource\Package\Release\Info:private] => "PHP License"
  9. [releasingMaintainer:Pickling\Resource\Package\Release\Info:private] => "lstrojny"
  10. [summary:Pickling\Resource\Package\Release\Info:private] => "Communicate with any AMQP compliant server"
  11. [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."
  12. [releaseDate:Pickling\Resource\Package\Release\Info:private] => "2020-04-05 15:41:28"
  13. [releaseNotes:Pickling\Resource\Package\Release\Info:private] => "- Windows build: avoid variable lengths arrays (Christoph M. Becker) (https://github.com/pdezwart/php-amqp/issues/368)
  14. For a complete list of changes see:
  15. https://github.com/pdezwart/php-amqp/compare/v1.10.1...v1.10.2"
  16. [releaseSize:Pickling\Resource\Package\Release\Info:private] => 107350
  17. [downloadUri:Pickling\Resource\Package\Release\Info:private] => "https://pecl.php.net/get/amqp-1.10.2"
  18. [packageLink:Pickling\Resource\Package\Release\Info:private] => ""
  19. )

License

This library is licensed under the MIT License.