PHP code example of alsbury / chiphpotle-rest

1. Go to this page and download the library: Download alsbury/chiphpotle-rest 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/ */

    

alsbury / chiphpotle-rest example snippets



Client = Client::create('http://spicedb:8443/', 'mysecret');

$request = new CheckPermissionRequest(
    ObjectReference::create('user', 'bob'),
    'view',
    SubjectReference::create('document', 'topsecret1'),
);
try {
    $response = $apiClient->checkPermission($request);
    if ($response->getPermissionship() == Permissionship::HAS_PERMISSION) {
        echo 'You may Pass!'
    }
} catch (Exception $e) {
    echo 'Exception when calling PermissionsServiceApi->permissionsServiceCheckPermission: ', $e->getMessage(), PHP_EOL;
}
bash
vendor/bin/php-cs-fixer fix