Hi, I have run composer require cerbos/cerbos-sdk-...
# help
j
Hi, I have run composer require cerbos/cerbos-sdk-php which doesn't seem to produce an error. I am trying the example PHP call as follows: $client = CerbosClientBuilder::newInstance("localhost") ->withPlaintext(true) ->build(); But I get Uncaught Error: Class "CerbosClientBuilder" not found In the error log? Where am I going wrong?
o
Hi, Have you importing the class with `use`:
Copy code
use Cerbos\Sdk\Builder\CerbosClientBuilder;
or like this:
Copy code
$client = \Cerbos\Sdk\Builder\CerbosClientBuilder::newInstance("localhost")
    ->withPlaintext(true)
    ->build();
j
Tried that and I now get Uncaught Error: Class "Cerbos\Sdk\Builder\CerbosClientBuilder"
o
Could you share your
composer
version and the output for the
composer require cerbos/cerbos-sdk-php
?
j
Composer version 2.8.9 ./composer.json has been updated Running composer update cerbos/cerbos-sdk-php Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Writing lock file Installing dependencies from lock file (including require-dev) Nothing to install, update or remove Generating autoload files 26 packages you are using are looking for funding. Use the
composer fund
command to find out more! No security vulnerability advisories found. Using version ^1.8 for cerbos/cerbos-sdk-php
o
Can you add the autoloader to your php script and try again:
Copy code
require __DIR__ . '/vendor/autoload.php';
j
require(/var/www/html/vendor/autoload.php): Failed to open stream:
o
How is your setup so I can try to reproduce locally?
j
I am using Ubuntu 24 LTS on an Azure VM? The web server is nginx. What else do you want to know?
o
Any framework?
j
No
👍🏻 1
Apart from bootstrap
o
I quickly created a demo app for demonstrating how it could work. I leaved the Azure part out, but it should probably easy to adapt the demo to your requirements. Hope it helps.