PHP code example of flagrow / flarum-api-client

1. Go to this page and download the library: Download flagrow/flarum-api-client 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/ */

    

flagrow / flarum-api-client example snippets




lagrow\Flarum\Api\Flarum;

$api = new Flarum('http://example.com');

// A collection of discussions from the first page of your Forum index.
$discussions = $api->discussions()->request();
// Read a specific discussion.
$discussion = $api->discussions()->id(1)->request();
// Read the first page of users.
$users = $api->users()->request();

$api = Flarum('http://example.com', ['token' => '<insert-master-token>; userId=1']);