1. Go to this page and download the library: Download sapistudio/restapi 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/ */
sapistudio / restapi example snippets
use SapiStudio\RestApi\AbstractHttpClient;
/**
* Class HttpClient.
*/
class HttpClient extends AbstractHttpClient
{
protected $headers = [
any custom header as array
];
protected $requestModifiers = [RequestModifier::class];
protected $responseFormat = 'xml json or txt';
protected function buildRequestUri($baseUri,$path=false)
{
format your own custom request url
}
}
use SapiStudio\RestApi\Request\Modifier;
class RequestModifier extends Modifier
{
public function apply()
{
$this->httpClient->setOption('base_uri', $this->httpClient->getConfig('your config key set on init'));//this is a
use SapiStudio\RestApi\AbstractApi;
class MyApi extends AbstractApi
{
public function myapiFunction()
{
$this->addFormParameter('apifunc',$functionName);
return $this->post(true,$parameters);
return $this->get(true,$parameters);
}
}
$class = new HttpClient();
$class->setConfig(['key' => value]);
$apicall = $class->api('MyApi')->myapiFunction();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.