2017 © Pedro Peláez
 

library supervisor-client

The php client for supervisor

image

frag-seb/supervisor-client

The php client for supervisor

  • Thursday, November 16, 2017
  • by frag-seb
  • Repository
  • 0 Watchers
  • 0 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Software License Build Status Coverage Status codecov, (*1)

Total Downloads, (*2)

Supervisor API Client, (*3)

ToDo: - documentation - example - etc., (*4)

Example of a simple way to create a client manager., (*5)

<?php


use FragSeb\Supervisor\Factory\ManagerFactory;

/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';

$config = [
    'master' => [
        'host' => 'http://localhost:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ],
    'slave' => [
        'host' => 'http://localhost2:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ]
];

$factory = new ManagerFactory();

$manager =  $factory->create($config);

try {
    $client = $manager;

    var_dump($client->getAllProcessInfo());
} catch (\Exception $exception) {
    echo 'message: ' . $exception->getMessage() . PHP_EOL;
    echo 'code: ' . $exception->getCode() . PHP_EOL;
    exit;
}

Example for multi server call., (*6)

<?php

use FragSeb\Supervisor\Factory\ClientFactory;
use FragSeb\Supervisor\Factory\XmlRpcConnectorFactory;
use FragSeb\Supervisor\Serializer\XmlRpcSerializer;
use FragSeb\Supervisor\Registry\ServerRegistry;
use FragSeb\Supervisor\Registry\ClientRegistry;
use FragSeb\Supervisor\ClientManager;
use FragSeb\Supervisor\Factory\ServerFactory;
use FragSeb\Supervisor\Response\ResponseBuilder;

/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';

$config = [
    'master' => [
        'host' => 'http://localhost:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ],
    'slave' => [
        'host' => 'http://localhost2:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ]
];

$clientRegistry = new ClientRegistry(
    new ServerRegistry($config, new ServerFactory),
    new XmlRpcConnectorFactory(new XmlRpcSerializer),
    new ClientFactory(new ResponseBuilder)
);

/** @var \FragSeb\Supervisor\Client\ClientInterface $manager */
$manager =  new ClientManager($clientRegistry);


try {
    var_dump($manager->getAllProcessInfo());
} catch (\Exception $exception) {
    echo 'message: ' . $exception->getMessage() . PHP_EOL;
    echo 'code: ' . $exception->getCode() . PHP_EOL;
    exit;

}

Example for single call., (*7)

<?php

use FragSeb\Supervisor\Factory\ClientFactory;
use FragSeb\Supervisor\Factory\XmlRpcConnectorFactory;
use FragSeb\Supervisor\Serializer\XmlRpcSerializer;
use FragSeb\Supervisor\Registry\ServerRegistry;
use FragSeb\Supervisor\Registry\ClientRegistry;
use FragSeb\Supervisor\ClientManager;
use FragSeb\Supervisor\Factory\ServerFactory;
use FragSeb\Supervisor\Response\ResponseBuilder;

/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';

$config = [
    'master' => [
        'host' => 'http://localhost:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ],
    'slave' => [
        'host' => 'http://localhost2:9001/RPC2',
        'auth' => [
            'username' => 'user',
            'password' => 123
        ]
    ]
];

$clientRegistry = new ClientRegistry(
    new ServerRegistry($config, new ServerFactory),
    new XmlRpcConnectorFactory(new XmlRpcSerializer),
    new ClientFactory(new ResponseBuilder)
);

/** @var \FragSeb\Supervisor\Client\ClientInterface $manager */
$manager =  new ClientManager($clientRegistry);

try {
    $client = $manager->getClient('master');

    var_dump($client->getAllProcessInfo());
} catch (\Exception $exception) {
    echo 'message: ' . $exception->getMessage() . PHP_EOL;
    echo 'code: ' . $exception->getCode() . PHP_EOL;
    exit;
}

The Versions

16/11 2017

dev-develop

dev-develop

The php client for supervisor

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jochen Mandl

api client supervisor

25/09 2017

dev-master

9999999-dev

The php client for supervisor

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Jochen Mandl

api client supervisor