{"id":17024994,"url":"https://github.com/havenstd06/laravel-plex","last_synced_at":"2025-07-15T12:39:12.600Z","repository":{"id":63021551,"uuid":"564546566","full_name":"Havenstd06/laravel-plex","owner":"Havenstd06","description":"A Laravel package that allows access to the API of your Plex server.","archived":false,"fork":false,"pushed_at":"2023-06-25T19:18:03.000Z","size":175,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T06:11:19.885Z","etag":null,"topics":["api","laravel","php","plex"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Havenstd06.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-11T00:17:58.000Z","updated_at":"2024-06-20T17:02:58.000Z","dependencies_parsed_at":"2022-11-11T05:16:48.867Z","dependency_job_id":null,"html_url":"https://github.com/Havenstd06/laravel-plex","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Havenstd06%2Flaravel-plex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Havenstd06%2Flaravel-plex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Havenstd06%2Flaravel-plex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Havenstd06%2Flaravel-plex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Havenstd06","download_url":"https://codeload.github.com/Havenstd06/laravel-plex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248558253,"owners_count":21124240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","laravel","php","plex"],"created_at":"2024-10-14T07:27:43.210Z","updated_at":"2025-04-12T11:22:14.877Z","avatar_url":"https://github.com/Havenstd06.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Laravel Plex\n### A Laravel package that allows access to the API of your Plex server.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg height=\"200\" src=\"https://user-images.githubusercontent.com/33732634/201248345-0df081eb-da1d-4605-92bb-e4c40bfdcd78.png\" /\u003e   \n\u003c/p\u003e\n\n## Installation\n\n```bash\ncomposer require havenstd06/laravel-plex\n```\n\n#### Publish Assets\n```bash\nphp artisan vendor:publish --provider=\"Havenstd06\\LaravelPlex\\Providers\\PlexServiceProvider\" \n```\n\n#### Configuration\nAfter publishing the assets, add the following to your .env files .\n\n```env\n# Plex API\nPLEX_SERVER_URL=\nPLEX_TOKEN=\n\nPLEX_CLIENT_IDENTIFIER=\nPLEX_PRODUCT=havenstd06/laravel-plex\nPLEX_VERSION=1.0.0\n\nPLEX_VALIDATE_SSL=true\n```\n\n#### Configuration File\nThe configuration file plex.php is located in the config folder. Following are its contents when published:\n\n```php\nreturn [\n    'server_url'         =\u003e env('PLEX_SERVER_URL', ''), // Plex Server URL (ex: http://[IP address]:32400)\n    'token'              =\u003e env('PLEX_TOKEN', ''),\n\n    'client_identifier'  =\u003e env('PLEX_CLIENT_IDENTIFIER', ''), // (UUID, serial number, or other number unique per device)\n    'product'            =\u003e env('PLEX_PRODUCT', 'havenstd06/laravel-plex'), // (Plex application name, eg Laika, Plex Media Server, Media Link)\n    'version'            =\u003e env('PLEX_VERSION', '1.0.0'), // (Plex application version number)\n\n    'validate_ssl'       =\u003e env('PLEX_VALIDATE_SSL', true), // Validate SSL when creating api client.\n];\n```\n## Usage\n\n#### Initialization\n\n```php\nuse Havenstd06\\LaravelPlex\\Services\\Plex as PlexClient;\n\n$provider = new PlexClient;\n```\n\n#### Override Configuration\nYou can override Plex API configuration by calling setApiCredentials method:\n\n```php\n$config = [\n    'server_url'        =\u003e 'https://example.com',\n    'token'             =\u003e 'your-token',\n    \n    'client_identifier' =\u003e 'your-client-identifier',\n    'product'           =\u003e 'your-product',\n    'version'           =\u003e 'your-version',\n    \n    'validate_ssl'      =\u003e true,\n];\n\n$provider-\u003esetApiCredentials($config);\n```\n## Integrations\n\n#### Accounts\n\n**Sign In** to return Plex user data (included token).\n```php\n$data = [\n    'auth' =\u003e [\n        'username/email', // Required\n        'password', // Required\n    ],\n    'headers' =\u003e [\n        // Headers: https://github.com/Arcanemagus/plex-api/wiki/Plex.tv#request-headers\n        // X-Plex-Client-Identifier is already defined in default config file\n    ]\n];\n\n// The second parameter allows you to choose if you want to\n// authenticate with the token registered in the config\n// (ONLY IF THE TOKEN EXISTS).\n$plexUser = $provider-\u003esignIn($data, false);\n$token = $plexUser['user']['authToken'];\n```\n\nGet server accounts details.\n```php\n$provider-\u003egetAccounts();\n```\n\nGet account information\n```php\n$provider-\u003egetPlexAccount();\n```\n\nGet Plex.TV account information.\n```php\n$provider-\u003egetServerPlexAccount();\n```\n\n\u003chr\u003e\n\n#### Users\n\nList all home users, including guests (Users \u0026 Sharing in UI)\n```php\n$provider-\u003egetUsers();\n```\n\nValidate username or email\n```php\n$provider-\u003evalidateUser('username | email');\n```\n\n\u003chr\u003e\n\n#### Friends\n\nGet shares friends list.\n```php\n$provider-\u003egetFriends();\n```\n\nInvite a friend.  \nIf you don't pass an array with the library ids (`$librarySectionIds`), all the libraries of the server will be taken.\nSettings are optional too.\n\n```php\nuse Havenstd06\\LaravelPlex\\Classes\\FriendRestrictionsSettings;\n\n$librarySectionIds = [\n    652397653,\n    765367227,\n    887542234\n];\n\n$settings = new FriendRestrictionsSettings(\n    allowChannels: '1',\n    allowSubtitleAdmin: '1',\n    allowSync: '0',\n    allowTuners: '0',\n    filterMovies: '',\n    filterMusic: '',\n    filterTelevision: '',\n);\n\n$provider-\u003einviteFriend('me@hvs.cx', $librarySectionIds, $settings);\n```\n\nCancel invitation.\n```php\n$provider-\u003ecancelInvite('me@hvs.cx');\n```\n\nGet pending invitations list.\n```php\n$provider-\u003egetPendingInvites();\n```\n\nRemove friend.\n```php\n$provider-\u003eremoveFriend(12345678); // Friend ID / InvitedID\n```\n\nGet friends details\n```php\n$provider-\u003egetFriendDetail(12345678); // Friend ID / InvitedID\n```\n\nUpdate friend restrictions\n\n```php\nuse Havenstd06\\LaravelPlex\\Classes\\FriendRestrictionsSettings;\n\n$settings = new FriendRestrictionsSettings(\n    allowChannels: '1',\n    allowSubtitleAdmin: '1',\n    allowSync: '0',\n    allowTuners: '0',\n    filterMovies: '',\n    filterMusic: '',\n    filterTelevision: '',\n);\n\n$provider-\u003eupdateFriendRestrictions(12345678, $settings); // Friend ID / InvitedID\n```\n\nUpdate friend libraries\n```php\n$librarySectionIds = [\n    652397653,\n    765367227,\n    887542234\n];\n\n$provider-\u003eupdateFriendLibraries(12345678, $librarySectionIds); // Friend ID / InvitedID\n```\n\n\u003chr\u003e\n\n#### Server\n\nGet the local List of servers.\n```php\n$provider-\u003egetServers();\n```\n\nGet servers detail (contain libraries ids)\n\n```php\n$provider-\u003egetServerDetail($machineIdentifier); // optional argument\n```\n\nGet server identity details\n```php\n$provider-\u003egetServerIdentity();\n```\n\nGets a list of servers and their sections. Limited to servers that have remote access enabled.\nThe second parameter is for include lite.\n```php\n$provider-\u003egetPmsServers(true);\n```\n\nGet server capabilities details. Transcode bitrate info, server info.\n```php\n$provider-\u003egetServerCapabilities();\n```\n\nGets the server preferences.\n```php\n$provider-\u003egetServerPreferences();\n```\n\n\u003chr\u003e\n\n#### System\n\nGeneral plex system information.\n```php\n$provider-\u003egetSystem();\n```\n\nAgents available (and some of their configuration)\n```php\n$provider-\u003egetSystemAgents();\n```\n\n\u003chr\u003e\n\n#### Databases\n\nThis will search in the database for the string provided.\n```php\n$provider-\u003esearchDatabase('Avengers');\n```\n\n\u003chr\u003e\n\n#### Sessions\n\nThis will retrieve the \"Now Playing\" Information of the PMS.\n```php\n$provider-\u003egetNowPlaying();\n```\n\nRetrieves a listing of all history views.\n```php\n$provider-\u003egetViewsHistory();\n```\n\n\u003chr\u003e\n\n#### Devices\n\nGets a list of available clients and servers.\n```php\n$provider-\u003egetDevices();\n```\n\nGet servers devices details.\n```php\n$provider-\u003egetDevices();\n```\n\n\u003chr\u003e\n\n#### Resources\n\nGets a list of servers, devices and their sections\n```php\n$provider-\u003egetResources();\n```\n\n\u003chr\u003e\n\n#### Libraries\n\nThis will search in the library for the string provided. \nThe second parameter is the limit.\n```php\n$provider-\u003esearchLibrary('Avengers', 10);\n```\n\nShow ondeck list\n```php\n$provider-\u003egetOnDeck();\n```\n\nContains all of the sections on the PMS.\nConfusingly, Plex's UI calls a section a library: e.g. \"TV shows\" or \"Movies\".\nThis acts as a directory and you are able to \"walk\" through it.\n```php\n$provider-\u003egetLibraries();\n```\n\nGet all data in the library for the section passed in.\n```php\n$provider-\u003egetLibrary(1);\n```\n\nDelete a section\n```php\n$provider-\u003edeleteLibrary(1);\n```\n\nRefreshes the library for the section passed in.\n```php\n$provider-\u003erefreshLibrary(1);\n```\n\n\u003chr\u003e\n\n#### Playlists\n\nGet playlists list.\n```php\n$provider-\u003egetPlaylists();\n```\n\nThe key associated with a library.  \nThis key can be found by calling the ``getPlaylists`` method.\n```php\n$provider-\u003egetPlaylist(2);\n```\n\nThe key associated with a library.  \nThis key can be found by calling the ``getPlaylists`` method.\n```php\n$provider-\u003egetPlaylistItems(2);\n```\n\n\u003chr\u003e\n\n#### Medias\n\nGet photo of specified height and width.\n```php\n$provider-\u003egetPhoto('path', 480, 719);\n```\n\nAsk the server whether it can provide the video with/without transcoding (based on the client profile).\n```php\n$provider-\u003egetVideo('path', 'http');\n```\n\nMarks item with the corresponding \"rating key\" as watched.\n```php\n$provider-\u003escrobble('item rating key');\n```\n\nMarks item with the corresponding \"rating key\" as unwatched.\n```php\n$provider-\u003eunscrobble('item rating key');\n```\n\nMarks media item with the corresponding \"rating key\" as partially watched, populating its \"viewOffset\" field.  \nTime is in milliseconds.\n```php\n$provider-\u003eprogress('item rating key', 'offset');\n```\n\n\u003chr\u003e\n\n#### Translations\n\nGet Translations for example: fr\n```php\n$provider-\u003egetTranslations('fr');\n```\n\n\u003chr\u003e\n\n## Acknowledgements\n\n- [Plexopedia](https://www.plexopedia.com/plex-media-server/api/)\n- [Arcanemagus/Plex-API](https://github.com/Arcanemagus/plex-api/wiki)\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n\n## Contributing\n\nPull requests are welcome.  \nFor major changes, please open an issue first to discuss what you would like to change.  \nPlease make sure to update tests as appropriate.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavenstd06%2Flaravel-plex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhavenstd06%2Flaravel-plex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavenstd06%2Flaravel-plex/lists"}