Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
Jose Erick Carreon edited this page Apr 21, 2019 · 4 revisions

Introduction

Welcome to the PHPlex WIKI!, These are all functions that you can use in the library.

If you need information about structure and general operation you can consult the Documentation.

Two forms get a server instantiate.

Through constructor

You can create a new object of type Plex to which you can pass only the parameters username, password that are data obligatory thought for default address will be 'localhost' and the port '32400'.

$plex = new Plex('username', 'password');
$server = $plex->getServer();

Otherwise, you can specific the address and port

$plex = new Plex('username', 'password', '192.168.6.2', '32402');
$server = $plex->getServer();

Through registering servers

You also can make a array with multiples servers where it will have the data necessaries and even the token.

$servers = array(
	'my_server' => array( // Name with which you want to identify the configuration of the server.
		'username' => 'username', // Username or email of the plex.tv account.
		'password' => 'password' // Password of the plex.tv account.
		'address' => '192.168.11.9', // Ip of the server or localhost.
		'port' => '32401' // Ip port, default 32400.
		'token' => '********' // Connexion token, default phplex generate one.
	),
	'my_server_two' => array(
		'username' => 'email',
		'password' => 'password'
		'port' => '32402'
	),
	'my_server_three' => array(
		'username' => 'Plex',
		'password' => 'phplex'
		'address' => '192.152.147.125'
	),
	// ...
);

$plex = new Plex();
$plex->registerServers($servers);
$server_two = $plex->getServer('my_server_two');

Get client instantiate.

Also once started the server instantiate, you can get the clients connected to plex server.

$clients = $plex->getAllClients();
foreach ($clients as $client){
	echo $client->name;
}

Similarly, you get a client specific

$client = $plex->getClient('TV Smart');