auth3-dev/auth3-sdk

Library for the Auth3 Identity Platform APIs, learn more at https://auth3.dev/.

1.0.0 2021-10-17 21:05 UTC

This package is auto-updated.

Last update: 2024-04-10 17:08:18 UTC


README

The official Auth3 php SDK library.

API Documentation

Check-out the API documentation at https://docs.auth3.dev/apis/identity-platform/administrative for further help.

Installation

Prerequisites

Please, note that using this library requires that you also Install gRPC for PHP on your system.

Missing to do so, will result in import errors regarding gRPC libraries (such as, Error: Class 'Grpc\ChannelCredentials' not found). In that case, make sure that to sudo pecl install grpc-<version> the same version of the resolved PHP library, to avoid any kind of issues.

Mac users which installed php via brew should also make sure to use the correct php binary, rather than the system-wide /usr/bin/php. You can see your binary location with brew list php (for example, /usr/local/Cellar/php/8.0.11_1/bin/php). Failing to do so could lead to the same issues stated above, because the extension=grpc.so might have been configured on another php installation.

Automated

$ composer require auth3-dev/auth3-sdk

Manual

Using composer to get the library, add to your composer.json:

"require": {
  "auth3-dev/auth3-sdk": "^1.0.0"
}

Then run:

$ composer install # or "update"

Within your code you can now:

<?php

require('vendor/autoload.php');

$client = new Auth3\Identity\Admin\AdminClient('<admin-endpoint-as-found-in-your-Console>', [
    'credentials' => Grpc\ChannelCredentials::secure(),
]);

$request = new Auth3\Identity\Admin\GetConnectionsRequest();
// This is how you can use setters to provide parameters to the request:
// $request->setAttribute($request);
// in this case it's not needed.

list($response, $status) = $client->getConnections($request)->wait();
if ($status->code !== Grpc\STATUS_OK) {
    echo "ERROR: " . $status->code . ", " . $status->details . PHP_EOL;
    exit(1);
}

// do something with the response:
// $response.getConnections()

Examples

Check-out the examples/ folder to see how to initialise a client and perform queries.

Execute it with:

$ cat examples/admin/main.php # customise client connection info
$ composer install
$ php -d extension=grpc.so main.php

NOTE You will need to add extension=grpc.so into your php.ini file. Or add -d extension=grpc.so to your command line to load the needed extensions. Failing to do so won't resolve some libraries imports. Check out the documentation to setup your environment.

Additional help

You can find further help, examples, tools and suggestions here.

Change Language

Not your target language? Check out our official SDKs for:

Contributing

At this time we don't accept external contributions, but we're open for feedbacks and requests. We're always looking for contributions on our security, refer to our dedicated page for more.

Support

Customers of the Auth3 Identity Platform can access support through the official channels available on our website. We won't be able to accomodate Customer requests through the bug tracker for security reasons.

License

Read the LICENSE.