imemento / clients
Client library classes for iMemento Services
Installs: 2 448
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
- illuminate/contracts: ^8.0
- illuminate/support: ^8.0
- imemento/sdk-auth: ~8.1.0
- opis/closure: ^3.1
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-26 21:19:18 UTC
README
Client library classes for iMemento Services
Check the full docs in here https://imemento-clients.readthedocs.io
Installation
composer require imemento/clients
Quick Usage
use Facades\iMemento\Clients\Profiles; //... public function index() { $user = Profiles::showUser(1234); }
Modifier Methods
// it returns an empty response on failure $user = Profiles::silent()->showUser(1234); // it throws an exception on failure $user = Profiles::critical()->showUser(1234); // it retries the request 3 times if it fails $user = Profiles::retries(3)->showUser(1234);
Async
use GuzzleHttp\Promise; // ... $promises = [ 'profiles' => Profiles::async()->showUser(1234), 'roles' => Roles::async()->listRoles(), ]; $results = Promise\settle($promises)->wait();
Authentication
// as the current running service (the env variables need to be set) $org = Profiles::asService()->showOrganization(1234); // as the currently logged in user $org = Profiles::asUser()->showOrganization(1234); // as the given user $org = Profiles::as($user)->showOrganization(1234); // with the provided token $org = Profiles::withToken($token)->showOrganization(1234); // anonymous calls $org = Profiles::anonymously()->showOrganization(1234);