PHP code example of libern / someline-starter-api-client
1. Go to this page and download the library: Download libern/someline-starter-api-client 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/ */
libern / someline-starter-api-client example snippets
php
'providers' => [
...
Libern\Rest\RestClientServiceProvider::class,
...
],
bash
php artisan vendor:publish
php
$restClient = new \Libern\Rest\RestClient('someline-starter');
$restClient->setOAuthUserCredentials([
'username' => '[email protected]',
'password' => 'Abc12345',
]);
$restClient->withOAuthTokenTypeUser();
$response = $restClient->get("users")->getResponse();
if (!$restClient->isResponseStatusCode(200)) {
$restClient->printResponseOriginContent();
$responseMessage = $restClient->getResponseMessage();
print_r($responseMessage);
} else {
$responseData = $restClient->getResponseData();
print_r($responseData);
}