1. Go to this page and download the library: Download hampel/xenforo-api-laravel 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/ */
use Hampel\XenForo\Api\Laravel\XenForoManager;
public function __construct(private readonly XenForoManager $forums) {}
$this->forums->forum('support')->users()->get(1);
use Hampel\XenForo\Api\Client;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
$client = new Client(
$config,
$credential,
app('xenforo.http_client'),
app(RequestFactoryInterface::class),
app(StreamFactoryInterface::class),
);
use Hampel\XenForo\Api\Exception\NotAuthenticatedException;
use Hampel\XenForo\Api\Exception\NotFoundException;
try {
$user = XenForo::users()->get($id);
} catch (NotFoundException $e) {
// no such user - or the acting user may not see them, which is the same 404
} catch (NotAuthenticatedException $e) {
// the key is not usable. A configuration error, not an empty result.
}