PHPackages                             chindit/plex-api - 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. chindit/plex-api

ActiveLibrary[API Development](/categories/api)

chindit/plex-api
================

A simple API library to interact with a Plex server

2.1.4(5mo ago)02732GPL-3.0-or-laterPHPPHP ^8.4CI failing

Since Jan 23Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/chindit/plex-api)[ Packagist](https://packagist.org/packages/chindit/plex-api)[ RSS](/packages/chindit-plex-api/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (4)Versions (8)Used By (0)

Plex API
========

[](#plex-api)

### Installation

[](#installation)

```
composer require chindit/plex-api
```

### Usage

[](#usage)

Create a new instance of `PlexServer`

Minimal parameters to pass are server host and token.

```
$plex = new Chindit\PlexServer('http://path.to.my.plex', 'MyPlexToken');
```

You can also provide a specific port as third argument (default is 32400) and some options as fourth parameters. Options must be suppored by Symfony's HTTP client.

Most common parameters are `max_redirects` and `timeout`.

In this case, server initialization will look like this:

```
$plex = new Chindit\PlexServer('http://path.to.my.plex', 'MyPlexToken', 32400, ['timeout' => 10]);
```

To find you plex token, [check this article](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/)

### Methods available

[](#methods-available)

Once your `$plexserver` instance created, following methods are available:

- `checkConnection(): bool` Checks if connection can be made to your Plex instance.
- `servers(): array` Returns the list of active servers for your Plex instance.

    Response is an array of `Chindit\Model\Server` objects
- `sessionsCount(): int` Returns the number of active sessions on the server. An active session is a device streaming a media.
- `libraries(): array` Returns all you libraries. A Plex library is a general section like your «Movies» or «Shows» categories. All your medias are contained in libraries.
- `library(int $libraryId): array` Return all the media contained in a specific library. Library id can be obtained by a `getId()` on a `Library` object.
- `getFromKey(int|string $ratingKey): ?Movie` Return 0 or 1 movie based on the given rating key.
- `refreshMovie(Movie $movie): ?Movie` Refresh movie information from Plex server. Will return `null` if movie is not longer found on Plex.

    Example:

    ```
    $myLibraries = $plexServer->libraries();
    $theLibraryIWant = $myLibraries[0]; // Choose any library you want;
    $myMedias = $plexServer->library($theLibraryIWant->getId());
    ```

    Response is an array of `Chindit\Model\Movie` and `Chindit\Model\Show` objects.

### Need help?

[](#need-help)

If you need a specific call, have a suggestion or found a bug, do not hesitate tot leave a comment on the `Issue` tab.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance70

Regular maintenance activity

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

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 ~241 days

Recently: every ~314 days

Total

7

Last Release

172d ago

Major Versions

1.0.1 → 2.0.02022-08-05

PHP version history (4 changes)1.0.0PHP ^8.1

2.0.1PHP ^8.2

2.1.2PHP ^8.3

2.1.3PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2115451?v=4)[David Lumaye](/maintainers/chindit)[@chindit](https://github.com/chindit)

---

Top Contributors

[![chindit](https://avatars.githubusercontent.com/u/2115451?v=4)](https://github.com/chindit "chindit (41 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chindit-plex-api/health.svg)

```
[![Health](https://phpackages.com/badges/chindit-plex-api/health.svg)](https://phpackages.com/packages/chindit-plex-api)
```

###  Alternatives

[storyblok/php-management-api-client

Storyblok PHP Client for Management API

1233.5k3](/packages/storyblok-php-management-api-client)

PHPackages © 2026

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