survos / flickr-bundle
Symfony bundle that wraps samwilson/phpflickr library
Fund package maintenance!
kbond
Installs: 339
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- endroid/installer: ^1.4
- samwilson/phpflickr: ^5.1
- symfony/config: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
- twig/twig: ^3.4
Requires (Dev)
- phpstan/phpstan: ^1.10
- symfony/browser-kit: ^6.4 || ^7.0
- symfony/framework-bundle: ^6.4 || ^7.0
- symfony/phpunit-bridge: ^6.4 || ^7.0
- symfony/security-bundle: ^6.4 || ^7.0
- symfony/twig-bundle: ^6.4 || ^7.0
- symfony/var-dumper: ^6.4 || ^7.0
- dev-main
- 1.5.378
- 1.5.377
- 1.5.376
- 1.5.375
- 1.5.374
- 1.5.373
- 1.5.372
- 1.5.371
- 1.5.370
- 1.5.369
- 1.5.368
- 1.5.367
- 1.5.366
- 1.5.365
- 1.5.364
- 1.5.363
- 1.5.362
- 1.5.361
- 1.5.360
- 1.5.359
- 1.5.358
- 1.5.357
- 1.5.356
- 1.5.355
- 1.5.354
- 1.5.353
- 1.5.352
- 1.5.351
- 1.5.350
- 1.5.349
- 1.5.345
- 1.5.344
- 1.5.343
- 1.5.342
- 1.5.341
- 1.5.340
- 1.5.339
- 1.5.338
- 1.5.337
- 1.5.336
- 1.5.335
- 1.5.334
- 1.5.333
- 1.5.332
- 1.5.331
- 1.5.330
- 1.5.329
- 1.5.328
- 1.5.327
- 1.5.326
- 1.5.325
- 1.5.324
- 1.5.323
- 1.5.322
- 1.5.321
- 1.5.320
- 1.5.319
- 1.5.318
- 1.5.317
- 1.5.316
- 1.5.315
- 1.5.314
- 1.5.313
- 1.5.312
- 1.5.311
- 1.5.310
- 1.5.309
- 1.5.308
- 1.5.307
- 1.5.306
- 1.5.305
- 1.5.304
- 1.5.303
- 1.5.302
- 1.5.301
- 1.5.300
- 1.5.299
- 1.5.298
- 1.5.297
- 1.5.296
- 1.5.295
- 1.5.294
- 1.5.293
- 1.5.292
- 1.5.291
- 1.5.290
- 1.5.289
- 1.5.288
- 1.5.287
- 1.5.286
- 1.5.285
- 1.5.284
- 1.5.283
- 1.5.282
- 1.5.281
- 1.5.280
- 1.5.279
- 1.5.278
- 1.5.277
- 1.5.276
- 1.5.275
- 1.5.274
- 1.5.273
- 1.5.272
- 1.5.271
- 1.5.270
- 1.5.269
- 1.5.268
- 1.5.267
- 1.5.266
- 1.5.265
- 1.5.264
- 1.5.263
- 1.5.262
- 1.5.261
- 1.5.260
- 1.5.259
- 1.5.258
- 1.5.257
- 1.5.256
- 1.5.255
- 1.5.254
- 1.5.253
- 1.5.252
- 1.5.251
- 1.5.250
- 1.5.249
- 1.5.248
- 1.5.247
- 1.5.246
- 1.5.245
- 1.5.244
- 1.5.243
- 1.5.242
- 1.5.241
- 1.5.240
- 1.5.239
- 1.5.238
- 1.5.237
- 1.5.236
- 1.5.235
- 1.5.234
This package is auto-updated.
Last update: 2024-11-04 17:03:16 UTC
README
A Symfony bundle that wraps flickr library at https://github.com/samwilson/phpflickr
In addition to putting the api key and secret in environment variables, there are 2 twig functions that make getting the thumbnail and the photo page easy. Note that if you embed the thumbnail in a webpage, you are required (by their terms of service) to provide a link to the photo page on Flickr.
{% set url = flickrThumbnailUrl(photo) %} <figure class="figure"> <a href="{{ flickrPageUrl(photo) }}" target="_blank">
Installation
composer require survos/flickr-bundle
Demo App
symfony new flickr-demo --webapp && cd flickr-demo composer config extra.symfony.allow-contrib true cat > .env.local <<END FLICKR_API_KEY=the-key FLICKR_SECRET=the-secret END composer require survos/flickr-bundle
Get an API key and secret at https://www.flickr.com/services/api/keys/ and replace the dummy values in .env.local
bin/console importmap:require bootstrap echo "import 'bootstrap/dist/css/bootstrap.min.css'" >> assets/app.js bin/console make:controller AppController -i cat <<'EOF' > src/Controller/AppController.php <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Survos\FlickrBundle\Services\FlickrService; class AppController extends AbstractController { #[Route('/', name: 'flickr_list')] public function __invoke(FlickrService $flickr): Response { $userId = '26016159@N00'; $result = $flickr->photosets()->getPhotos( 72177720317358478, $userId, ['media' => 'photos, url_o, tags'] ); return $this->render('app.html.twig', [ 'photos' => $result ]); } } EOF cat > templates/app.html.twig <<END {% extends 'base.html.twig' %} {% block body %} {% for photo in photos.photo %} {% set url = flickrThumbnailUrl(photo) %} <figure class="figure"> <a href="{{ flickrPageUrl(photo) }}" target="_blank"> <img src="{{ url }}" class="figure-img img-fluid rounded" alt="..."> </a> <figcaption class="figure-caption text-end">{{ photo.title }}</figcaption> </figure> {% endfor %} {% endblock %} END symfony server:start -d symfony open:local