infradigital / api-client
Infra Digital Nusantara APIs Client Adapter
Requires
- php: >=5.6
- php-http/cache-plugin: ^1.2
- php-http/client-common: ^1.3
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.1
- php-http/logger-plugin: ^1.0
- psr/cache: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- fzaninotto/faker: ^1.8
- guzzlehttp/psr7: ^1.2
- php-http/guzzle6-adapter: ^1.0
- phpunit/phpunit: ^4.0 || ^5.5
This package is auto-updated.
Last update: 2025-03-19 23:19:36 UTC
README
INFRA DIGITAL NUSANTARA APIs
This is APIs library used for doing request to IDN endpoint.
You may install this library from composer.
You can install this library using this command
composer require infradigital/api-client
or by registering the library packagist namespace into your composer.json file
{ "require": { "infradigital/api-client": "1.*" } }
then invoke the composer install command
php composer install
HOW TO
To initiate the API class you can import first the ApiClient class like this
use InfraDigital\ApiClient;
then initiate it in your php code
$idnClient = new ApiClient\Client($idnUserName, $idnPassword);
Once you already initiate the class you can use like this example
$idnClient->studentApi()->createStudent('Test User 1234' . date('YMDhis'), 'testBillKey01234' . date('YMDhis'),'0987612345', 'use.only@valid.domain', 'This is test to create user');
So it would look like this if we put it together
use InfraDigital\ApiClient;
$idnClient = new ApiClient\Client($idnUserName, $idnPassword);
$idnClient->studentApi()->createStudent('Test User 1234' . date('YMDhis'), 'testBillKey01234' . date('YMDhis'),'0987612345', 'use.only@valid.domain', 'This is test to create user');
You may put this short of code $idnClient->setDevMode();
after you initiate the class. Instead it will use IDN production domain as default uri.
$idnClient = new ApiClient\Client($idnUserName, $idnPassword);
$idnClient->setDevMode(); // This will be tell the class to use development uri
$idnClient->studentApi()->createStudent('Test User 1234' . date('YMDhis'), 'testBillKey01234' . date('YMDhis'),'0987612345', 'use.only@valid.domain', 'This is test to create user');