1. Go to this page and download the library: Download jooservices/flickr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jooservices / flickr example snippets
use JOOservices\Client\Client\ClientBuilder;
use JOOservices\Flickr\Config\FlickrConfig;
use JOOservices\Flickr\FlickrFactory;
use JOOservices\Flickr\Dtos\Photos\SearchPhotosData;
$http = ClientBuilder::create()
->withTimeout(30)
->build();
$flickr = FlickrFactory::make(
// Load API credentials from server-side secret storage.
config: new FlickrConfig(apiKey: $key, apiSecret: $secret),
http: $http,
);
// Typed priority workflow.
$page = $flickr->photos()->search(new SearchPhotosData(text: 'sunset', perPage: 20));
// Full known surface through the universal gateway.
$response = $flickr->api()->call('flickr.tags.getHotList', ['count' => 20]);
// Future/undocumented methods: explicit verb + explicit auth mode, never cached.
$response = $flickr->api()->raw(
method: 'flickr.future.method',
httpMethod: \JOOservices\Flickr\Enums\HttpMethod::Get,
options: new \JOOservices\Flickr\Api\RawCallOptions(\JOOservices\Flickr\Enums\AuthenticationMode::Unauthenticated),
parameters: ['query' => 'value'],
);
// Local metadata lookup.
$definition = $flickr->api()->describe('flickr.photos.search');
use JOOservices\Flickr\Auth\OAuthCallback;
use JOOservices\Flickr\Enums\AuthPermission;
$pending = $flickr->oauth()->begin(AuthPermission::Write); // immutable PendingAuthorization
// Persist $pending SERVER-SIDE bound to your logged-in user (10-minute lifetime),
// redirect the user to $pending->authorizationUrl, then on callback:
$token = $flickr->oauth()->complete(
$pending,
new OAuthCallback(token: $_GET['oauth_token'], verifier: $_GET['oauth_verifier']),
);
use JOOservices\Flickr\Upload\UploadOptions;
$result = $flickr->uploads()->upload('/path/photo.jpg', new UploadOptions(
title: 'Sunset',
tags: ['nature', 'big wave'], // multi-word tags are quoted automatically
async: false,
));
$status = $flickr->uploads()->uploadStatus(); // advisory quota, never blocks uploads
$factoryPoller = FlickrFactory::pollerFor($flickr);
$results = $factoryPoller->poll(['ticket-id'], 1000, 60_000); // bounded poller; not for web requests
use JOOservices\Client\Client\ClientBuilder;
use JOOservices\Flickr\Config\FlickrConfig;
use JOOservices\Flickr\FlickrFactory;
use JOOservices\Flickr\Testing\FlickrFake;
$fake = FlickrFake::create(); // builds on client v4 fakes
$client = ClientBuilder::create()->build();
// Load API credentials from server-side secret storage.
$flickr = FlickrFactory::make(
config: new FlickrConfig(apiKey: $key, apiSecret: $secret),
http: $client,
);
$fake->queueJson(['stat' => 'ok']);
// ... exercise the SDK ...
$fake->assertCall(0, 'flickr.photos.search', ['text' => 'sunset']);
$fake->close(); // call in tearDown()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.