Pexels API Client for

0.1.4 2019-04-17 08:26 UTC

This package is auto-updated.

Last update: 2022-11-11 12:50:54 UTC


Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads License


Install the Pexels API Client with Composer.

"require": {
    "glooby/pexels": "~0.1"


Create an instance of the Pexels API Client by passing in your API token as parameter.

$pexels = new \Glooby\Pexels\Client("xxxxx");

Perform a search, the response gets returned as an array

$response = $pexels->search('london');

Loop trough photos and display them

$photos = json_decode($pexels->search('london')->getBody())->photos;
foreach ($photos as $photo) {
 echo "<img src='{$photo->src->small}' width='{$photo->width}' heigth='{$photo->height}'>"

Example response