PHP plex-api How to use the Filter class (and others) (Is "USE" giving me problems?)

108 Views Asked by At

I recently discovered the PHP plex-api project, which provides a PHP-friendly means of working with the PLEX overall API.

I've had success as far as the general top-level API, but have been unable to figure out how to use the Filter (and other) classes that are intended to expand the capability. In short, I have the following code:

require_once('vendor/autoload.php') ;
use jc21\PlexApi ;
require_once('vendor/jc21/plex-api/src/jc21/Util/Filter.php') ;
$client = new PlexApi($creds['hostname']);
$client->setAuth($creds['userId'], $creds['password'] ) ;

... and I can successfully use the $client properties and methods. But when I try to execute this line:

filter1 = new Filter('title', $titleToFind) ;

I get a Class not found error. This confuses me since the (required) Util/Filter.php file starts with this code (Blank lines and comments removed)

namespace jc21\Util;
use Exception;
class Filter
{
    private string $field;

And so on.

I suspect it's the "use" keyword that's giving me fits (I consider myself pretty good with PHP but this one throws me for a loop - it's a new concept for me).

I didn't find a community reference in the github page for this (link above) so I have come here for help.

Any pointers?

Thanks!

0

There are 0 best solutions below