2017 © Pedro Peláez
 

library restgalleries

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

image

restgalleries/restgalleries

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  • Wednesday, August 27, 2014
  • by estebanmatias92
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

RestGalleries

Latest Stable Version Total Downloads Build Status License, (*1)

Is an API Client interface for interact with restful image services like Flickr through CRUD methods., (*2)

Requirements

  • PHP 5.4.0
  • (optional) PHPUnit 3.7+ for tests

Installing

The installation is done via composer, so it is necessary to have it installed. Copy and paste the code into your composer.json file., (*3)

"require": {
    "restgalleries/restgalleries": "0.5.*"
}

Docomentation

How to use

To use this library, you can create a model of the application, with the name of the API to be used:, (*4)

 'your-flickr-api-key',
        'consumer_secret' => 'your-flickr-secret-key'
        'callback'        => 'http://www.myapp.com/...' // Its optional, you can put it as parameter for 'connect' method
    ];

}

?>

That's all! Now you can use this model anywhere:, (*5)

setAuth($user->credentials)

// And now, you have all galleries from your Flickr account into an array!
$galleries = $model->all();

?>

Functions

API::connect($callback)

Receives the url callback for authentication and returns a Fluent object with user account properties and tokens (tokens from protocol oauth1 or oauth2)., (*6)

id;
$user->realname;
$user->username;
$user->url;
// Account tokens for oauth1
$user->credentials['consumer_key'];
$user->credentials['consumer_secret'];
$user->credentials['token'];
$user->credentials['token_secret'];
// Account tokens for oauth2
$user->credentials['access_token'];
$user->credentials['expires'];

?>
API::verifyCredentials($tokenCredentials)

Receives an array with the tokens credentials (for protocol oauth1 or oauth2) a Fluent object with the above properties or false in error case., (*7)

 'your-service-api-key',
    'consumer_secret' => 'your-service-api-secret',
    'token'           => 'any-service-account-token',
    'token_secret'    => 'any-service-account-token-secret'
];

$user = API::verifyCredentials($tokenCredentials);

$user->id;
$user->realname;
$user->username;
$user->url;
$user->consumer_key;
$user->consumer_secret;
$user->token;
$user->token_secret;

?>
API::setAuth($tokenCredentials)

Receives the token credentials (for protocol oauth1 or oauth2) and creates plugin to then make the authentication. Returns the model instance to make a fluent interface., (*8)

 'any-service-access-token',
    'expires'      => 'any-service-expire-date'
];

$model = new Api;
$model->setAuth($tokenCredentials);

?>
API::setCache($system, $path)

Receives as string the cache system to use (file or array for now), and as array the path to store the cache files (folder for now). Returns the model instance to make a fluent interface., (*9)

 'C:\Root\...'
];

$model = new Api;
$model->setCache($system, $path);

?>
API::getPlugins()

Returns an array with the established plugins, every keys has the plugin name, and has the plugin adapter object as value., (*10)

setCache($system, $path)
    ->setAuth($tokenCredentials)
    ->getPlugins();

$plugins['cache'];
$plugins['auth'];

?>
API::all()

Returns a Collection with all the object galleries found., (*11)

all();

$galleries[0]->id;
$galleries[0]->title;
$galleries[0]->description;
$galleries[0]->photos; // An array (Collection) of photo object
$galleries[0]->created;
$galleries[0]->url;
$galleries[0]->size;
$galleries[0]->user_id;
$galleries[0]->thumbnail;
$galleries[0]->views;

$photo = $galleries[0]->photos[0];

// Each photo object (Fluent class) contains this properties.
$photo->id;
$photo->title;
$photo->description;
$photo->url;
$photo->created;
$photo->views;
$photo->source;
$photo->source_thumbnail;

?>
API::find($id)

Receives the gallery id and returns a Fluent object with the gallery data., (*12)

find('any-service-gallery-id');

$gallery->id;
$gallery->title;
$gallery->description;
$gallery->photos; // An array (Collection) of photo object
$gallery->created;
$gallery->url;
$gallery->size;
$gallery->user_id;
$gallery->thumbnail;
$gallery->views;

?>

Contributing

Of course you can enhance this library through pull request, marking errors, perhaps adding support for other APIs :B, or whatever you see that this needs for improve. Todo contribution will be welcome., (*13)

License

Licensed under the MIT License - see the LICENSE file for details, (*14)

The Versions

27/08 2014

dev-master

9999999-dev

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

27/08 2014

dev-dev

dev-dev

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

27/08 2014

0.5.3

0.5.3.0

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

13/08 2014

0.5.2

0.5.2.0

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

08/08 2014

0.5.1

0.5.1.0

Is an API Client interface for interact with restful image services like Flickr through CRUD methods.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

07/08 2014

0.5.0

0.5.0.0

Is an API Client interface for interact with restful services like Flickr between others image web services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban

02/08 2014

0.4.9

0.4.9.0

Is an API Client interface for interact with restful services like Flickr between others image web services.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matias Esteban