https://github.com/euskadi31/spore
Spore client (rest) for PHP5.3+
https://github.com/euskadi31/spore
Last synced: 3 months ago
JSON representation
Spore client (rest) for PHP5.3+
- Host: GitHub
- URL: https://github.com/euskadi31/spore
- Owner: euskadi31
- License: mit
- Created: 2012-11-11T18:40:15.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-26T09:42:53.000Z (over 12 years ago)
- Last Synced: 2025-01-19T18:49:03.548Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 176 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spore
[](http://travis-ci.org/euskadi31/Spore)
This function is EXPERIMENTAL. The behaviour of this function, its name,
and surrounding documentation may change without notice in a future release of PHP.[SPORE](https://github.com/SPORE/) is a way to describe public services HTTP APIs such as [twitter] [1]
or applications with an HTTP interface such as [Apache CouchDB] [2]
using a simple language-agnostic JSON document that can be used by
various language-specific implementations to dynamically or statically
generate high level client objects.The goal of this git repository is to host:
* the specifications for the [SPORE description language] [3]
* the specifications for writing a [SPORE client implementation] [4][1]: http://github.com/SPORE/api-description/blob/master/services/twitter.json
[2]: http://github.com/SPORE/api-description/blob/master/apps/couchdb.json
[3]: http://github.com/SPORE/specifications/blob/master/spore_description.pod
[4]: http://github.com/SPORE/specifications/blob/master/spore_implementation.pod## Applications and services API descriptions
* [API Descriptions](http://github.com/spore/api-description)
## Install
Use [Composer.phar](http://getcomposer.org/)
cd Spore/
curl -s https://getcomposer.org/installer | php
php composer.phar install## Usage
The examples are a good place to start. The minimal you'll need to
have is:``` php
loadSpec(__DIR__ . '/spec/github.json');
$response = $client->call('GET', 'get_user', array(
'user' => 'euskadi31'
));print_r($response->getContent());
?>
```Output
stdClass Object
(
[type] => User
[company] => Audiofanzine
[public_gists] => 6
[followers] => 12
[created_at] => 2010-02-03T10:25:00Z
[blog] =>
[following] => 42
[email] =>
[public_repos] => 14
[location] => Toulouse, France
[html_url] => https://github.com/euskadi31
[name] => Axel Etcheverry
[hireable] =>
[url] => https://api.github.com/users/euskadi31
[gravatar_id] => 6171ad2ceddde3288b87c546e92f2909
[avatar_url] => https://secure.gravatar.com/avatar/6171ad2ceddde3288b87c546e92f2909?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png
[id] => 195383
[bio] => PHP & Zend Framework developer
[login] => euskadi31
)### Generated client
cd Spore/
bin/spore generate:client demo/spec/github.json``` php
getUser(array(
'user' => 'euskadi31'
));print_r($response->getContent());
?>
```Output
stdClass Object
(
[type] => User
[company] => Audiofanzine
[public_gists] => 6
[followers] => 12
[created_at] => 2010-02-03T10:25:00Z
[blog] =>
[following] => 42
[email] =>
[public_repos] => 14
[location] => Toulouse, France
[html_url] => https://github.com/euskadi31
[name] => Axel Etcheverry
[hireable] =>
[url] => https://api.github.com/users/euskadi31
[gravatar_id] => 6171ad2ceddde3288b87c546e92f2909
[avatar_url] => https://secure.gravatar.com/avatar/6171ad2ceddde3288b87c546e92f2909?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png
[id] => 195383
[bio] => PHP & Zend Framework developer
[login] => euskadi31
)## Test with [Atoum](https://github.com/mageekguy/atoum)
The tests can be executed by using this command from the base directory:
./vendor/mageekguy/atoum/bin/atoum --glob Tests/Units/
## Report Issues/Bugs
[Bugs](https://github.com/euskadi31/Spore/issues)