PHP code example of dragonmantank / plinth
1. Go to this page and download the library: Download dragonmantank/plinth 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/ */
dragonmantank / plinth example snippets
use Dragonmantank\Plinth\ClientInterface;
class OurSDK
{
public function __construct(protected ClientInterface $plinth)
{ }
public function createUser($userData): User
{
$response = $this->plinth->create('user', $userData);
$user = new User($response);
return $user;
}
public function removeUser(User $user): void
{
$this->plinth->delete('user/' . $user->id);
}
}
use Dragonmantank\Plinth\Client;
class OurSDK extends Client
{
// All the basic HTTP calls are available directly to the user
public function createUser($userData): User
{
$response = $this->create('user', $userData);
$user = new User($response);
return $user;
}
}