PHPackages                             eugenecooper/flickering - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. eugenecooper/flickering

ActiveLibrary[API Development](/categories/api)

eugenecooper/flickering
=======================

A modern interface for the Flickr API

0.1.6(8y ago)034MITPHPPHP &gt;=5.4.0

Since Sep 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/eugenecooper/flickering)[ Packagist](https://packagist.org/packages/eugenecooper/flickering)[ RSS](/packages/eugenecooper-flickering/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

Flickering
==========

[](#flickering)

[![Build Status](https://camo.githubusercontent.com/a39d87c945d77f51292325f40abcc6aa8c19f35ec8eaa65cb9ce81224ad875e3/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f416e61686b696173656e2f666c69636b6572696e672e7376673f7374796c653d666c6174)](https://travis-ci.org/Anahkiasen/flickering)[![Latest Stable Version](https://camo.githubusercontent.com/0c595625d74c7ac2da323b748c71f52c7c47c9d75f6e722e9ed4db8f0cad83f9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e61686b696173656e2f666c69636b6572696e672e7376673f7374796c653d666c6174)](https://packagist.org/packages/anahkiasen/flickering)[![Total Downloads](https://camo.githubusercontent.com/905d656a922a3899d76dd9ecbd3973377885869db6d6b9f1254fe1e807e8265e/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e61686b696173656e2f666c69636b6572696e672e7376673f7374796c653d666c6174)](https://packagist.org/packages/anahkiasen/flickering)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/518ac36b260e44e731a80b9f07eadf344c159060ea57f14441607704d7e67653/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f416e61686b696173656e2f666c69636b6572696e672e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/Anahkiasen/flickering/)[![Code Coverage](https://camo.githubusercontent.com/388036ed9df3388abe4fcf310ccf4701d8174f1399023c9581ae93e686bb2855/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f416e61686b696173656e2f666c69636b6572696e672e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/Anahkiasen/flickering/)[![Dependency Status](https://camo.githubusercontent.com/bb7c91eab22cec1b1a41f65ee633f36e4d94c2bf6e31ca71ed166f5b25bf9d0c/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3533663163363566313362623036373762313030303734342f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/53f1c65f13bb0677b1000744)[![Support via Gittip](https://camo.githubusercontent.com/2700a79f496bdf434db90ac70e5e44e4b01905a98d59b74c66e7d24fcdb2e7c4/687474703a2f2f696d672e736869656c64732e696f2f6769747469702f416e61686b696173656e2e7376673f7374796c653d666c6174)](https://www.gittip.com/Anahkiasen/)

Flickering is a next-generation PHP API for the [Flickr](http://www.flickr.com/) photos sharing social network. It's a **work in progress** but it already works so don't worry about that.

You can get it on Composer, in order to do so just run `composer require anahkiasen/flickering`.

After that add the ServiceProvider to the providers array in app/config/app.php

```
'Flickering\FlickeringServiceProvider',
```

If you want to use the facade, also add that to app.php:

```
 'Flickering' => 'Flickering\Facades\Flickering',
```

If you want to use store the api keys/secret in the config, publish the config files.

```
$ php artisan config:publish anahkiasen/flickering

```

Using Flickering
----------------

[](#using-flickering)

### Creating a new instance

[](#creating-a-new-instance)

To use Flickering you will of course need an API key from Flickr, if you don't already have on you get can [one here](http://www.flickr.com/services/apps/create/apply/), they're nice and all so they'll give you one for free. Once you have that, set it in Flickering's `config/config.php` file. Or if you don't want/can, you can always pass your credentials to the constructor.

To start working with Flickering, create a new instance of it like the example underneath. If you set your API credentials in the config file, you don't need to pass any arguments to the constructor as it will automatically fetch your key and secret key from the config files.

```
$flickering = App::make('flickering');
$flickering->handshake($apiKey, $apiSecret);
```

If working with instances is not your thing, Flickering also uses [Illuminate](https://github.com/illuminate/support)'s Facade component to provide a static interface to all its methods. You can create a new static instance of Flickering like this. Arguments are facultative if config file is set, same as above.

```
Flickering::handshake($apiKey, $apiSecret)
Flickering::handshake();    //Using the config file
```

Before doing anything with the Flickr api, you have to call the handshake (once).

### Calling methods on the Flickr API

[](#calling-methods-on-the-flickr-api)

Flickering provides several ways to make calls to the API. They differ in their level of syntaxic elegance and the level of control you get on the API response.

The most basic (but also the most powerful) way is to simply call the `->callMethod` on your Flickering instance :

```
Flickering::callMethod('people.getPhotos', array('user_id' => '31667913@N06'));
```

Alternatively, Flickering is set up with a bunch of smart aliases for common methods, so to the exact same thing as the example above you can also do the following.

```
Flickering::peopleGetPhotos('31667913@N06')
```

Note that the arguments for each smart alias are mapped from the list of arguments provided by the *Flickr* API, so in the example above we're actually calling the `flickr.people.getPhotos` method, meaning the number and order of its arguments can be found in the [API docs](http://www.flickr.com/services/api/explore/flickr.people.getPhotos).

Since changing that order of arguments would be messy, smart alias are mostly to be used when you want quick calls to method with few arguments — if you have to set every goddamn one of the method's arguments, it's recommanded to use `callMethod` instead — for the simple reason that with an associative array at least you'll always plainly see which argument maps to what.

### Getting results from a call to the API

[](#getting-results-from-a-call-to-the-api)

Now what we've just seen is all pretty basic stuff, and doesn't differ from most Flickr API implementations out there. Here is where stuff gets interesting. When you use one of the methods above to make a call on the API you don't directly get the results as a raw JSON string (although you can). By default, Flickering will return a **Method** object from which you can do various interesting stuff.

First, you can manipulate the results after the initial call, either via `->setParameter` or via the elegant aliases of Flickering.

```
$method = Flickering::peopleGetPhotos('31667913@N06')

$method->setParameter('per_page', 25) // or
$method->setPerPage(25)

$method->getPerPage() // 25
```

From there, **Method** has three methods for you to get your results from : `->getRawResponse`, `->getReponse` and `->getResults`.

- The first one as its name suggests just returns the raw response from Flickr, unparsed and untouched.
- The second one returns the original response, but parses it from JSON/XML/etc to an actual PHP array
- The third one returns a **Results** instance, and takes a single parameter a facultative subset of the results you might want to fetch directly. Per example when you get photos from a method of the Flickr API, the actual photos will be nested in a `photos` key of the response array. You can get them directly by doing `->getResults('photos')`. You can get nested results via dot-notation too : `->getResults('photos.0')`.

The **Results** class leverages the power behind [Underscore.php](http://anahkiasen.github.com/underscore-php) to create a live repository of your results, allowing you to easily manipulate them and fetch deeply nested informations from them. You can get a glimpse of the manipulation power brought by Underscore in the [Arrays docs](https://github.com/Anahkiasen/underscore-php/wiki/Arrays) and I also recommand quickly checking out what [Underscore Repositories](https://github.com/Anahkiasen/underscore-php/wiki/Repository) are and what they can do.

The whole *Flickering &gt; Method &gt; Request* process is bypassable via the matching methods on the **Flickering** instance : `->getRawResponseOf`, `->getResponseOf` and `->getResultsOf`. So the two examples below do the exact same thing, just faster :

```
$method = Flickering::callMethod('people.getPhotos', array('user_id' => '31667913@N06'))
$results = $method->getResults('photos')

// Same thing
$results = Flickering::getResultsOf('people.getPhotos', array('user_id' => '31667913@N06'))
```

### Authentified calls

[](#authentified-calls)

As the Flickr API is now powered by [OAuth](http://oauth.net/), making authentified requests to it will require a permission from the user. In order to speed up the process, Flickering has out-of-the-box an [Opauth](http://opauth.org/) *Strategy* set up.

If you're using Flickering with your favorite framework, use it's *Router* to leverage Flickering's `getOpauth` and `getOpauthCallback` methods. The first one must be **returned** in the first two steps of the process, the second one must just be present somewhere in your callback page (can be the same page you'll do your calls from once the user has given permission).

Here is an example implementation with the [Laravel](http://laravel.com/) framework :

```
Route::get('flickr/auth', function() {
    Flickering::handshake();
    return Flickering::getOpauth();
});
Route::any('flickr/oauth_callback', function() {
    Flickering::handshake();
    if(Request::getMethod() == 'POST'){
        Flickering::getOpauthCallback();
        return 'Authenticated!';
    }else{
        Flickering::getOpauth();
        return 'Being redirected..';
    }
});
```

If you're using any framework and just want to make some requests on a plain old PHP page, an example implementation via a basic router and *.htaccess* is demonstrated in the `example` folder of the repository.

### Working with the User

[](#working-with-the-user)

Once the user has been logged in you can get its informations via the `Flickering::getUser()` method which will return an **User** object containing the various informations sent back by the OAuth process. Here are some of the methods available :

```
Flickering::handshake();
$user = Flickering::getUser();

// Get OAuth token
$user->getKey()

// Get Flickr's UID of the person
$user->getUid()

// Get an array of basic informations on the person
$user->getInformations()

// Get the whole schebang : photos, photosets, friends, and other informations made public by the user
$user->getPerson()
```

Moreover, Flickering has a `isAuthentified` method for you to use that will check whether OAuth credentials are available or not.

That's all folks !
------------------

[](#thats-all-folks-)

Don't forget to post any issue/bug/request in the Github Issues.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~298 days

Recently: every ~326 days

Total

6

Last Release

3125d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.1.3PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/75191f939aee64e753855a3601c2180ba3d8242fe06139929e1a431c67fd2cda?d=identicon)[eugenecooper](/maintainers/eugenecooper)

---

Top Contributors

[![Anahkiasen](https://avatars.githubusercontent.com/u/1321596?v=4)](https://github.com/Anahkiasen "Anahkiasen (114 commits)")[![eugenecooper](https://avatars.githubusercontent.com/u/8261869?v=4)](https://github.com/eugenecooper "eugenecooper (5 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (5 commits)")[![delormejonathan](https://avatars.githubusercontent.com/u/5949870?v=4)](https://github.com/delormejonathan "delormejonathan (2 commits)")[![ecaron](https://avatars.githubusercontent.com/u/70704?v=4)](https://github.com/ecaron "ecaron (1 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")[![shaunpreston](https://avatars.githubusercontent.com/u/2205072?v=4)](https://github.com/shaunpreston "shaunpreston (1 commits)")

---

Tags

phpapilaravelflickr

### Embed Badge

![Health badge](/badges/eugenecooper-flickering/health.svg)

```
[![Health](https://phpackages.com/badges/eugenecooper-flickering/health.svg)](https://phpackages.com/packages/eugenecooper-flickering)
```

###  Alternatives

[anahkiasen/flickering

A modern interface for the Flickr API

535.9k1](/packages/anahkiasen-flickering)[joisarjignesh/bigbluebutton

BigBlueButton Server API Library for Laravel

162145.5k1](/packages/joisarjignesh-bigbluebutton)[jeroen-g/flickr

Modern PHP package to make Flickr API calls. Ships with Laravel implementation.

2559.9k2](/packages/jeroen-g-flickr)[exlo89/laravel-sevdesk-api

A helpful Sevdesk API client for Laravel.

1116.5k](/packages/exlo89-laravel-sevdesk-api)[dystcz/lunar-api

Dystore API layer for Lunar e-commerce package

411.1k3](/packages/dystcz-lunar-api)[yxx/laravel-quick

agile development

145.3k](/packages/yxx-laravel-quick)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
