PHPackages                             devscast/pexels - 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. devscast/pexels

ActiveLibrary[API Development](/categories/api)

devscast/pexels
===============

PHP client for https://pexels.com

1.2.0(2mo ago)101.0k↓14.3%21MITPHPPHP &gt;=8.4CI passing

Since Jul 28Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/devscast/pexels-php)[ Packagist](https://packagist.org/packages/devscast/pexels)[ GitHub Sponsors](https://github.com/devscast)[ RSS](/packages/devscast-pexels/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (10)Versions (10)Used By (1)

Pexels PHP
==========

[](#pexels-php)

[![Lint](https://github.com/devscast/pexels/actions/workflows/lint.yaml/badge.svg)](https://github.com/devscast/pexels/actions/workflows/lint.yaml/badge.svg)[![Test](https://github.com/devscast/pexels/actions/workflows/test.yaml/badge.svg)](https://github.com/devscast/pexels/actions/workflows/test.yaml/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/67617682fec8f1e9d55a4af3b8af88a9863a2325613af73f0765cb5dce833fc6/68747470733a2f2f706f7365722e707567782e6f72672f64657673636173742f706578656c732f76657273696f6e)](https://packagist.org/packages/devscast/pexels)[![Total Downloads](https://camo.githubusercontent.com/1d1e5ed367a7dde2fbf143d67997b5d57c86fd7a2d8b5832f6ef0be12eaa759e/68747470733a2f2f706f7365722e707567782e6f72672f64657673636173742f706578656c732f646f776e6c6f616473)](https://packagist.org/packages/devscast/pexels)[![License](https://camo.githubusercontent.com/6a98d763572b0bd80e86647083b6cdd264206ceb6ae74be9aff52913c6e674c9/68747470733a2f2f706f7365722e707567782e6f72672f64657673636173742f706578656c732f6c6963656e7365)](https://packagist.org/packages/devscast/pexels)

The Pexels API enables programmatic access to the full Pexels content library, including photos, videos. All content is available free of charge, and you are welcome to use Pexels content for anything you'd like, as long as it is within our Guidelines.

Guidelines
----------

[](#guidelines)

Whenever you are doing an API request make sure to show a prominent link to Pexels. You can use a text link (e.g. "Photos provided by Pexels") or a link with our logo.

Always credit our photographers when possible (e.g. "Photo by John Doe on Pexels" with a link to the photo page on Pexels).

You may not copy or replicate core functionality of Pexels (including making Pexels content available as a wallpaper app).

Do not abuse the API. By default, the API is rate-limited to 200 requests per hour and 20,000 requests per month. You may contact us to request a higher limit, but please include examples, or be prepared to give a demo, that clearly shows your use of the API with attribution. If you meet our API terms, you can get unlimited requests for free.

Abuse of the Pexels API, including but not limited to attempting to work around the rate limit, will lead to termination of your API access.

Authorization
-------------

[](#authorization)

Authorization is required for the Pexels API. Anyone with a Pexels account can [request an API key](https://www.pexels.com/api/new/), which you will receive instantly.

Install
-------

[](#install)

```
composer require devscast/pexels
```

Usage
-----

[](#usage)

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

```
// ...
use Devscast\Pexels\Client;
// ...

$pexels = new Client(token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx');
```

### Search for photos

[](#search-for-photos)

This endpoint enables you to search Pexels for any topic that you would like. For example your query could be something broad like Nature, Tigers, People. Or it could be something specific like Group of people working.

```
$photos = $pexels->searchPhotos('Tigers');

// landscape photos only
$photos = $pexels->searchPhotos('Tigers', new SearchParameters(orientation: 'landscape', page: 2))
```

### Curated photos

[](#curated-photos)

This endpoint enables you to receive real-time photos curated by the Pexels team.

We add at least one new photo per hour to our curated list so that you always get a changing selection of trending photos.

```
$photos = $pexels->curatedPhotos();

// paginated
$photos = $pexels->curatedPhotos(new PaginationParameters(page: 2, per_page: 60));
```

### Get a photo

[](#get-a-photo)

Retrieve a specific Photo from its id.

```
$photo = $pexels->photo(id: 11762029);
```

### Search for videos

[](#search-for-videos)

This endpoint enables you to search Pexels for any topic that you would like. For example your query could be something broad like Nature, Tigers, People. Or it could be something specific like Group of people working.

```
$videos = $pexels->searchVideos('Tigers');

// landscape videos only
$videos = $pexels->searchVideos('Tigers', new SearchParameters(orientation: 'landscape', page: 2))
```

### Popular Videos

[](#popular-videos)

This endpoint enables you to receive the current popular Pexels videos.

```
$videos = $pexels->popularVideos();

// 30 secondes popular videos
$videos =  $pexels->popularVideos(new PopularVideosParameters(min_duration: 30, max_duration: 30));
```

### Get a video

[](#get-a-video)

Retrieve a specific Video from its id.

```
$video = $pexels->video(id: 12593410);
```

### Featured Collections

[](#featured-collections)

This endpoint returns all featured collections on Pexels.

```
$collections = $pexels->featuredCollections();

// paginated
$collections = $pexels->featuredCollection(new PaginationParameters(per_page: 80);
```

### My Collections

[](#my-collections)

This endpoint returns all of your collections.

```
$collections = $pexels->collections();
```

### Collection media

[](#collection-media)

This endpoint returns all the media (photos and videos) within a single collection. You can filter to only receive photos or videos using the type parameter.

```
$collection = $pexels->collection(id: 'someid');

// videos only
$collection = $pexels->collection(id: 'someid', new CollectionParameters(type: 'Videos'));
```

Pagination
----------

[](#pagination)

Most Pexels API requests return multiple records at once. All of these endpoints are paginated, and can return a maximum of 80 requests at one time. Each paginated request accepts the same parameters and returns the same pagination data in the response.

Note: The prev\_page and next\_page response attributes will only be returned if there is a corresponding page.

Contributors
------------

[](#contributors)

[ ![](https://camo.githubusercontent.com/804ac77c6ad3abb52945f84ed6abb9a58c989cf3a0a944991fe329cd7ed5079a/68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d64657673636173742f706578656c73)](https://github.com/devscast/pexels/graphs/contributors)

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance90

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~162 days

Recently: every ~87 days

Total

9

Last Release

83d ago

PHP version history (3 changes)1.0.0PHP &gt;=8.1

1.1.2PHP &gt;=8.2

1.2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bedcab13d646b66f5a4f9a033106249f315ca355526179126843009828086c3?d=identicon)[bernard-ng](/maintainers/bernard-ng)

---

Top Contributors

[![bernard-ng](https://avatars.githubusercontent.com/u/31113941?v=4)](https://github.com/bernard-ng "bernard-ng (16 commits)")

---

Tags

api-clientngandupexels-apiphotostockapiimagespexelsstock image

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devscast-pexels/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)[api-platform/serializer

API Platform core Serializer

223.4M31](/packages/api-platform-serializer)[glooby/pexels

Pexels API Client for www.pexels.com

2731.6k1](/packages/glooby-pexels)[smnandre/pagespeed-api

PageSpeed Insight PHP Api Client 🚀 Analyse web pages for performances metrics, core web vitals...

1511.5k](/packages/smnandre-pagespeed-api)[upcloudltd/upcloud-php-api

UpCloud PHP API

2422.0k](/packages/upcloudltd-upcloud-php-api)

PHPackages © 2026

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