Git Product home page Git Product logo

pear-client's Introduction

PEAR client

CircleCI codecov

PEAR channel server REST interface

Usage

<?php

use GuzzleHttp\MessageFormatter;
use Psr\Log\LogLevel;
use Sweetchuck\PearClient\PearClient;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;

require_once './vendor/autoload.php';

$logOutput = new ConsoleOutput();
$logVerbosity = [
    LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET,
    LogLevel::ALERT     => OutputInterface::VERBOSITY_QUIET,
    LogLevel::CRITICAL  => OutputInterface::VERBOSITY_QUIET,
    LogLevel::ERROR     => OutputInterface::VERBOSITY_QUIET,
    LogLevel::WARNING   => OutputInterface::VERBOSITY_QUIET,
    LogLevel::NOTICE    => OutputInterface::VERBOSITY_QUIET,
    LogLevel::INFO      => OutputInterface::VERBOSITY_QUIET,
    LogLevel::DEBUG     => OutputInterface::VERBOSITY_QUIET,
];
$logger              = new ConsoleLogger($logOutput, $logVerbosity);
$logMessageFormatter = new MessageFormatter();

$options = [
    'base_uri' => 'https://pecl.php.net/rest/',
    'handler'  => PearClient::createHttpClientHandlerStack(
        null,
        $logger,
        $logMessageFormatter,
    ),
];

$pecl = new PearClient(PearClient::createHttpClient($options));

$categories = $pecl->categoriesGet();
foreach ($categories->list as $category) {
    echo "name: {$category->name}", PHP_EOL;
    echo "href: {$category->href}", PHP_EOL;

    $packages = $pecl->categoryPackagesGet($category->name);
    foreach ($packages->list as $package) {
        echo "name: {$package->name}", PHP_EOL;
        echo "description: {$category->description}", PHP_EOL;

        break;
    }

    break;
}

pear-client's People

Contributors

sweetchuck avatar

Watchers

 avatar James Cloos avatar  avatar

pear-client's Issues

PHP 8.1 compatibility

ERROR: Return type of Sweetchuck\PearClient\DataType\Base::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
in /.../sweetchuck/pear-client-1.x/src/DataType/Base.php:52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.