Download the PHP package kpacha/suricate-php-sdk without Composer

On this page you can find all versions of the php package kpacha/suricate-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package suricate-php-sdk

suricate-php-sdk

A suricate sdk for php

Build Status

Requirements

Installation

Standalone

Git installation

Clone the repo

$ git clone https://github.com/kpacha/suricate-php-sdk.git

Install the php dependencies

$ cd suricate-php-sdk
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install

Composer installation

Create a project with composer

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar create-project kpacha/suricate-php-sdk [directory]

Remeber to set the [directory] parameter or composer will create the project in your current path.

As a library

Include the kpacha/suricate-php-sdk package in your compose.json with all the dependencies of your project

"require":{
    "kpacha/suricate-php-sdk": "~1.0"
}

Usage

The suricate sdk comes with a simple client and several console commands bundled in a simple app.

Suricate client

The Kpacha\Suricate\Suricate constructor requires a rest client. The client must implement the Guzzle\Http\ClientInterface interface.

use Guzzle\Http\Client;
use Kpacha\Suricate\Suricate;
$suricateClient = new Suricate(new Client($suricateServerUrl));

Also, there is a builder to help you

use Kpacha\Suricate\SuricateBuilder;
$suricateClient = SuricateBuilder::build(suricateServerUrl);

And now the $suricateClient object is ready to work. Here you have some examples

try{
    $success = $suricateClient->putService($serviceName, $nodeId, $node);
    $serviceNames = $suricateClient->getAllNames();
    $nodes = $suricateClient->getAll($serviceName);
    $node = $suricateClient->get($serviceName, $nodeId);
    $success = $suricateClient->removeService($serviceName, $nodeId);
} catch (\Kpacha\Suricate\SuricateException $e) {
    // do something cleaver
}

Check the test for more details.

Suricate console app

Run the suricate script to trigger any console command. You can use them as a:

Check out the list built-in command and get a list of all the available commands.

$ bin/suricate list

----------------------------------------------------------------------------
 .oooooo..o                       o8o                          .             
d8P'    `Y8                       `"'                        .o8             
Y88bo.      oooo  oooo  oooo d8b oooo   .ooooo.   .oooo.   .o888oo  .ooooo.  
 `"Y8888o.  `888  `888  `888""8P `888  d88' `"Y8 `P  )88b    888   d88' `88b 
     `"Y88b  888   888   888      888  888        .oP"888    888   888ooo888 
oo     .d8P  888   888   888      888  888   .o8 d8(  888    888 . 888    .o 
8""88888P'   `V88V"V8P' d888b    o888o `Y8bod8P' `Y888""8o   "888" `Y8bod8P' 
----------------------------------------------------------------------------

Suricate version 0.0.1-Beta

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  help                 Displays help for a command
  list                 Lists commands
suricate
  suricate:all         Get a list of all the registered nodes by a given service (getAll)
  suricate:get         Get a node by a given service and id (get)
  suricate:heartbeat   Put a node by in a service cluster and update it periodically
  suricate:names       Get a list of all the registered service names (getAllNames)
  suricate:put         Put a node in a service cluster (putService)
  suricate:remove      Remove a node by a given service and id (removeService)

Remember, you can also get more details about any command just adding the --help option.

$ bin/suricate suricate:heartbeat --help
Usage:
 suricate:heartbeat [-s|--service="..."] [-i|--id="..."] [--node="..."] [-t|--total="..."] [-w|--wait="..."] suricate-server

Arguments:
 suricate-server       the suricate server url

Options:
 --service (-s)        name of the servie
 --id (-i)             id of the node
 --node                the node in json format
 --total (-t)          the total heartbeats to send
 --wait (-w)           the sleep time between consecutive heartbeats in secs
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.

Suricate only accepts payloads as String, so you should model your data with that in mind and, maybe, instead of seeing it as a limitation and send just plain texts, you would add some serializated info. Just remember, ZooKeeper is not a database, so use it with caution!


All versions of suricate-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/console Version ~2.4
guzzle/guzzle Version ~3.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kpacha/suricate-php-sdk contains the following files

Loading the files please wait ....