1. Go to this page and download the library: Download duukkis/maphpodon 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/ */
duukkis / maphpodon example snippets
class Accounts
{
// takes in the Maphpodon wrapper with GuzzleClient
public function __construct(protected Maphpodon $maphpodon)
{
}
/**
* @link https://docs.joinmastodon.org/methods/accounts/#get
* @param string $id
* @return Account
*/
public function get(string $id): Model|Account
{
return Mapper::mapJsonObjectToClass(
$this->maphpodon->get(sprintf('v1/accounts/%s', $id), []),
new Account()
);
}
/**
* @link https://docs.joinmastodon.org/methods/accounts/#statuses
* @param string $id
* @param array $params
* @return Status[]
*/
public function statuses(string $id, array $params = []): array
{
return Mapper::mapJsonObjectToClassArray(
$this->maphpodon->get(sprintf('v1/accounts/%s/statuses', $id), ["query" => $params]),
new Status()
);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.