rezzza/flickr-bundle
Symfony bundle that integrates the Flickr API into your application via the php-flickr library. It registers configurable services for photo, gallery, and account operations, letting you inject a ready-to-use Flickr client through the container instead of wiring credentials and HTTP handling yoursel...
The bundle is a thin Symfony wrapper around the Flickr API (via phpflickr-style library), so the day-to-day value is: register once, inject a configured client, and stop re-implementing auth/HTTP plumbing.
composer require rezzza/flickr-bundle:^1.0
app/AppKernel.php (this is a Symfony 2.x-era bundle; it will not auto-register on Symfony 4+):
new Rezzza\FlickrBundle\RezzzaFlickrBundle(),
parameters.yml:
# config.yml
rezzza_flickr:
api_key: %flickr_api_key%
secret: %flickr_secret%
Resources/config/services.yml in the bundle itself. The service id (typically rezzza.flickr) and constructor args are defined there, and that file is the ground truth for what's actually available — the README is thin.$flickr = $this->get('rezzza.flickr');
$photos = $flickr->people_getPublicPhotos($nsid);
Inject, don't fetch. Treat the Flickr client like any other infrastructure service. Define a small FlickrGallery service that takes the bundle's client as a constructor argument, so you can mock it in tests and swap caching strategies later.
Wrap the API surface. The wrapper exposes the underlying library's magic methods (photos_search, photosets_getPhotos, people_getPublicPhotos, etc.). Don't scatter these calls in controllers — create one repository-style class per resource (photos, photosets, users) and normalize the raw arrays into your own DTOs. The Flickr response shape is stable but awkward (photo / photos wrappers, string IDs).
Cache aggressively. Flickr rate-limits and every call is a network round-trip. Wrap repository methods in Symfony's cache service:
$key = 'flickr.photosets.'.$id;
if (false === $data = $this->cache->fetch($key)) {
$data = $this->client->photosets_getPhotos($id);
$this->cache->save($key, $data, 3600);
}
Build URLs from the response, not from strings. Flickr returns farm, server, id, secret fields; assemble https://farm{farm}.staticflickr.com/{server}/{id}_{secret}_{size}.jpg. Centralize this in one helper — sizes (_s, _m, _b, _z, _c) are easy to typo.
Background jobs for mutations. Uploads, set edits, and deletes should go through a message/queue worker rather than the request cycle, since Flickr calls can take seconds and occasionally time out.
Configuration injection tip: keep api_key/secret in environment-specific parameters rather than hard-coding, and never expose the secret to the frontend — only use the read-only public endpoints client-side if at all.
phpflickr/rezzza/flickr library directly and skip the bundle entirely if you're not on Symfony 2.rezzza.flickr) vs. class-based injection differ across versions — confirm in services.yml before writing use statements.phpflickr code often returns false or an error object rather than throwing. Always check if ($result === false) — a missing token or bad key won't raise an exception.secret matches the key pair and that you're not mixing REST and OAuth endpoints.format and per_page quirks. Some methods ignore per_page above 500; pagination is 1-indexed. Don't assume total is accurate for large sets.How can I help you explore Laravel packages today?