PHP code example of tentakelfabrik / pirectus

1. Go to this page and download the library: Download tentakelfabrik/pirectus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tentakelfabrik / pirectus example snippets


composer 



use Pirectus\Pirectus;
use Pirectus\Auth\TokenAuth;

$pirectus = new Pirectus('<directus-url>', [
    'auth' => new TokenAuth('<directus-authtoken>')
]);

$results = $pirectus
    ->items('pages')
    ->fields(['id', 'title', 'content'])
    ->filter([
        'status' => ['_eq' => 'published']
    ])
    ->find();