1. Go to this page and download the library: Download frangeris/skeleton-provider 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/ */
namespace Providers\Test;
use Skeleton\SDK\Providers\AbstractProvider,
Skeleton\SDK\Common\Supplier\ISupplier
;
/**
* Mock provider test class
*/
class TestProvider extends AbstractProvider implements ISupplier
{
public function create($provider)
{}
public function read()
{}
public function update($provider)
{}
public function delete($id)
{}
public function getById($id)
{}
}
// test/run.php
K\Common\Client,
Providers\Test\TestProvider
;
// Setting up the client with the configuration and credentials
$config = [
'method' => 'hmac', // Signature to use
'public_key' => 'asdasdasd',
'private_key' => 'zxzxzxzxzx',
'base_url' => ['http://{identifier}.{domain}.io/{version}', ['version' => 'v1', 'identifier' => 'demo4354589', 'domain' => 'mockable']],
];
$client = Client::getInstance()->setConfig($config);
// Data to send
$data = [
'email' => '[email protected]',
'first_name' => 'Jhon',
'last_name' => 'Doe',
'phone' => '000-000-0000'
];
// Lets create the new test
$test = new TestProvider($client);
print $test->create($data);
// src/provider/test/TestProvider.php
class TestProvider extends AbstractProvider implements ISupplier
{
public function create($provider)
{
if (!is_array($provider))
$provider = $this->skeleton->fragment($provider);
return $this->skeleton->post('/tests', $provider);
}
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.