2017 © Pedro Peláez
 

library php-spore2

SPORE, a generic ReST client

image

criztianix/php-spore2

SPORE, a generic ReST client

  • Monday, June 12, 2017
  • by CriztianiX
  • Repository
  • 1 Watchers
  • 2 Stars
  • 823 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

PHP-Spore

SPORE, a generic ReST client for PHP7, (*1)

require_once("vendor/autoload.php");
use PHP_Spore\Spore;

Now, you can generate a spore object from an array, (*2)

$spore = Spore::newFromArray([
   "base_url" => "https://httpbin.org",
   "methods" => [
       "get" => [
           "path" => "/get",
           "method" => "GET"
       ],
       "query_params" => [
           "path" => "/response-headers",
           "method" => "GET",
           "params" => [
               "limit" => [ "required" => true ]
           ]
       ],
       "post" => [
           "path" => "/post",
           "method" => "POST"
       ]
   ]
]);

or you can use a json file with the spec., (*3)

$spore = Spore::newFromJson(__DIR__ . "spec.json");

Request and enpoint is very easy, (*4)

$response = $spore->post([
    "params" => [
        "limit" => 10,
        "page" => 1
    ],
    "form-data" => [
        "data" => [
            1,2,3
        ]
    ]
]);

Spore now support hydrate models from api response., (*5)

$spec = [ 
  "base_url" => "https://httpbin.org",
  "methods" => [
    "getCache" => [
      "path" => "/cache",
      "model" => "PHP_Spore\\Test\\Response\\Cache"
    ]
  ]
]

and our cache model, look like this:, (*6)

<?php
namespace PHP_Spore\Test\Response;

use \PHP_Spore\Spore_Property;
class Cache
{
    public $url;
    /**
     * @Spore_Property(class = "PHP_Spore\Test\Response\Headers")
     */
    public $headers;
}

class Headers
{
    public $Host;
}

The Versions

12/06 2017

dev-master

9999999-dev

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

12/06 2017

1.1.5

1.1.5.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

24/01 2017

1.1.4

1.1.4.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

02/06 2016

1.1.3

1.1.3.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

01/06 2016

1.1.2

1.1.2.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

31/05 2016

1.1.1

1.1.1.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

31/05 2016

1.1.0

1.1.0.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

The Development Requires

11/01 2016

1.0.4

1.0.4.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

11/01 2016

1.0.3

1.0.3.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

11/01 2016

1.0.2

1.0.2.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

07/01 2016

1.0.0

1.0.0.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires

 

05/01 2016

1.0.1

1.0.1.0

SPORE, a generic ReST client

  Sources   Download

GNU

The Requires