Skip to content

Quick and dirty Flickr API for PHP with simple file cache.

Notifications You must be signed in to change notification settings

d3designs/flickr

Repository files navigation

FlickrCache API

This API will construct the appropriate Flickr REST API URL to query, and use RequestCore and json_decode() to retrieve and parse the JSON data (by default). The extended FlickrCache response differs from the default Flickr class response. To get the actual response data, you don't have to use $response->body, you can simply use $response. Simple file based caching support has also been added, but is disabled by default. You can enable it by using the cache_mode() method.

Requirements

Download

git clone [email protected]:jaywilliams/flickr.git
cd flickr
git submodule init
git submodule update

Setup

You can rename config-sample.inc.php to config.inc.php and add your key/secret there, or you can pass your key/secret key to the constructor.

I would recommend the former over the latter if you generally only use one key/secret set.

Example usage

If you want to make a request to Flickr's flickr.people.findByUsername method, you'd do the following. This makes a request using RequestCore, defaults to a JSON response from Flickr, and parses it with json_decode().

$flickr = new FlickrCache();
$flickr->cache_mode(true, 3600, './cache/');
$response = $flickr->people->find_by_username(array(
	'username' => 'skyzyx'
));
echo $response->user->id;
var_dump($response);

You can look through the response to see how to traverse through the data.

License & Copyright

Flickr Class

URL: http://github.com/skyzyx/flickr
Copyright (c) 2009, Ryan Parman MIT license

FlickrCache Class

URL: http://github.com/jaywilliams/flickr
Copyright (c) 2009, Jay Williams MIT license

About

Quick and dirty Flickr API for PHP with simple file cache.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages