PHPackages                             havenstd06/laravel-plex - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. havenstd06/laravel-plex

ActiveLibrary[HTTP &amp; Networking](/categories/http)

havenstd06/laravel-plex
=======================

A Laravel package that allows access to the API of your Plex server.

v1.0.4(3y ago)81155MITPHPPHP ^8.1

Since Nov 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Havenstd06/laravel-plex)[ Packagist](https://packagist.org/packages/havenstd06/laravel-plex)[ RSS](/packages/havenstd06-laravel-plex/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (5)Versions (6)Used By (0)

Laravel Plex
============

[](#laravel-plex)

### A Laravel package that allows access to the API of your Plex server.

[](#a-laravel-package-that-allows-access-to-the-api-of-your-plex-server)

 [![](https://user-images.githubusercontent.com/33732634/201248345-0df081eb-da1d-4605-92bb-e4c40bfdcd78.png)](https://user-images.githubusercontent.com/33732634/201248345-0df081eb-da1d-4605-92bb-e4c40bfdcd78.png)

Installation
------------

[](#installation)

```
composer require havenstd06/laravel-plex
```

#### Publish Assets

[](#publish-assets)

```
php artisan vendor:publish --provider="Havenstd06\LaravelPlex\Providers\PlexServiceProvider"
```

#### Configuration

[](#configuration)

After publishing the assets, add the following to your .env files .

```
# Plex API
PLEX_SERVER_URL=
PLEX_TOKEN=

PLEX_CLIENT_IDENTIFIER=
PLEX_PRODUCT=havenstd06/laravel-plex
PLEX_VERSION=1.0.0

PLEX_VALIDATE_SSL=true
```

#### Configuration File

[](#configuration-file)

The configuration file plex.php is located in the config folder. Following are its contents when published:

```
return [
    'server_url'         => env('PLEX_SERVER_URL', ''), // Plex Server URL (ex: http://[IP address]:32400)
    'token'              => env('PLEX_TOKEN', ''),

    'client_identifier'  => env('PLEX_CLIENT_IDENTIFIER', ''), // (UUID, serial number, or other number unique per device)
    'product'            => env('PLEX_PRODUCT', 'havenstd06/laravel-plex'), // (Plex application name, eg Laika, Plex Media Server, Media Link)
    'version'            => env('PLEX_VERSION', '1.0.0'), // (Plex application version number)

    'validate_ssl'       => env('PLEX_VALIDATE_SSL', true), // Validate SSL when creating api client.
];
```

Usage
-----

[](#usage)

#### Initialization

[](#initialization)

```
use Havenstd06\LaravelPlex\Services\Plex as PlexClient;

$provider = new PlexClient;
```

#### Override Configuration

[](#override-configuration)

You can override Plex API configuration by calling setApiCredentials method:

```
$config = [
    'server_url'        => 'https://example.com',
    'token'             => 'your-token',

    'client_identifier' => 'your-client-identifier',
    'product'           => 'your-product',
    'version'           => 'your-version',

    'validate_ssl'      => true,
];

$provider->setApiCredentials($config);
```

Integrations
------------

[](#integrations)

#### Accounts

[](#accounts)

**Sign In** to return Plex user data (included token).

```
$data = [
    'auth' => [
        'username/email', // Required
        'password', // Required
    ],
    'headers' => [
        // Headers: https://github.com/Arcanemagus/plex-api/wiki/Plex.tv#request-headers
        // X-Plex-Client-Identifier is already defined in default config file
    ]
];

// The second parameter allows you to choose if you want to
// authenticate with the token registered in the config
// (ONLY IF THE TOKEN EXISTS).
$plexUser = $provider->signIn($data, false);
$token = $plexUser['user']['authToken'];
```

Get server accounts details.

```
$provider->getAccounts();
```

Get account information

```
$provider->getPlexAccount();
```

Get Plex.TV account information.

```
$provider->getServerPlexAccount();
```

---

#### Users

[](#users)

List all home users, including guests (Users &amp; Sharing in UI)

```
$provider->getUsers();
```

Validate username or email

```
$provider->validateUser('username | email');
```

---

#### Friends

[](#friends)

Get shares friends list.

```
$provider->getFriends();
```

Invite a friend.
If you don't pass an array with the library ids (`$librarySectionIds`), all the libraries of the server will be taken. Settings are optional too.

```
use Havenstd06\LaravelPlex\Classes\FriendRestrictionsSettings;

$librarySectionIds = [
    652397653,
    765367227,
    887542234
];

$settings = new FriendRestrictionsSettings(
    allowChannels: '1',
    allowSubtitleAdmin: '1',
    allowSync: '0',
    allowTuners: '0',
    filterMovies: '',
    filterMusic: '',
    filterTelevision: '',
);

$provider->inviteFriend('me@hvs.cx', $librarySectionIds, $settings);
```

Cancel invitation.

```
$provider->cancelInvite('me@hvs.cx');
```

Get pending invitations list.

```
$provider->getPendingInvites();
```

Remove friend.

```
$provider->removeFriend(12345678); // Friend ID / InvitedID
```

Get friends details

```
$provider->getFriendDetail(12345678); // Friend ID / InvitedID
```

Update friend restrictions

```
use Havenstd06\LaravelPlex\Classes\FriendRestrictionsSettings;

$settings = new FriendRestrictionsSettings(
    allowChannels: '1',
    allowSubtitleAdmin: '1',
    allowSync: '0',
    allowTuners: '0',
    filterMovies: '',
    filterMusic: '',
    filterTelevision: '',
);

$provider->updateFriendRestrictions(12345678, $settings); // Friend ID / InvitedID
```

Update friend libraries

```
$librarySectionIds = [
    652397653,
    765367227,
    887542234
];

$provider->updateFriendLibraries(12345678, $librarySectionIds); // Friend ID / InvitedID
```

---

#### Server

[](#server)

Get the local List of servers.

```
$provider->getServers();
```

Get servers detail (contain libraries ids)

```
$provider->getServerDetail($machineIdentifier); // optional argument
```

Get server identity details

```
$provider->getServerIdentity();
```

Gets a list of servers and their sections. Limited to servers that have remote access enabled. The second parameter is for include lite.

```
$provider->getPmsServers(true);
```

Get server capabilities details. Transcode bitrate info, server info.

```
$provider->getServerCapabilities();
```

Gets the server preferences.

```
$provider->getServerPreferences();
```

---

#### System

[](#system)

General plex system information.

```
$provider->getSystem();
```

Agents available (and some of their configuration)

```
$provider->getSystemAgents();
```

---

#### Databases

[](#databases)

This will search in the database for the string provided.

```
$provider->searchDatabase('Avengers');
```

---

#### Sessions

[](#sessions)

This will retrieve the "Now Playing" Information of the PMS.

```
$provider->getNowPlaying();
```

Retrieves a listing of all history views.

```
$provider->getViewsHistory();
```

---

#### Devices

[](#devices)

Gets a list of available clients and servers.

```
$provider->getDevices();
```

Get servers devices details.

```
$provider->getDevices();
```

---

#### Resources

[](#resources)

Gets a list of servers, devices and their sections

```
$provider->getResources();
```

---

#### Libraries

[](#libraries)

This will search in the library for the string provided. The second parameter is the limit.

```
$provider->searchLibrary('Avengers', 10);
```

Show ondeck list

```
$provider->getOnDeck();
```

Contains all of the sections on the PMS. Confusingly, Plex's UI calls a section a library: e.g. "TV shows" or "Movies". This acts as a directory and you are able to "walk" through it.

```
$provider->getLibraries();
```

Get all data in the library for the section passed in.

```
$provider->getLibrary(1);
```

Delete a section

```
$provider->deleteLibrary(1);
```

Refreshes the library for the section passed in.

```
$provider->refreshLibrary(1);
```

---

#### Playlists

[](#playlists)

Get playlists list.

```
$provider->getPlaylists();
```

The key associated with a library.
This key can be found by calling the `getPlaylists` method.

```
$provider->getPlaylist(2);
```

The key associated with a library.
This key can be found by calling the `getPlaylists` method.

```
$provider->getPlaylistItems(2);
```

---

#### Medias

[](#medias)

Get photo of specified height and width.

```
$provider->getPhoto('path', 480, 719);
```

Ask the server whether it can provide the video with/without transcoding (based on the client profile).

```
$provider->getVideo('path', 'http');
```

Marks item with the corresponding "rating key" as watched.

```
$provider->scrobble('item rating key');
```

Marks item with the corresponding "rating key" as unwatched.

```
$provider->unscrobble('item rating key');
```

Marks media item with the corresponding "rating key" as partially watched, populating its "viewOffset" field.
Time is in milliseconds.

```
$provider->progress('item rating key', 'offset');
```

---

#### Translations

[](#translations)

Get Translations for example: fr

```
$provider->getTranslations('fr');
```

---

Acknowledgements
----------------

[](#acknowledgements)

- [Plexopedia](https://www.plexopedia.com/plex-media-server/api/)
- [Arcanemagus/Plex-API](https://github.com/Arcanemagus/plex-api/wiki)

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

Contributing
------------

[](#contributing)

Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

4

Last Release

1104d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.2|^8.0

v1.0.4PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/63080095138cd8f6a665e07f9bfef3310add62ede73fe6377334788691edc835?d=identicon)[Havenstd06](/maintainers/Havenstd06)

---

Top Contributors

[![Havenstd06](https://avatars.githubusercontent.com/u/33732634?v=4)](https://github.com/Havenstd06 "Havenstd06 (60 commits)")

---

Tags

apilaravelphpplexhttprestweb serviceplexlaravel plex

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/havenstd06-laravel-plex/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)

PHPackages © 2026

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