Giter Club home page Giter Club logo

flarum-api-client's Introduction

flarum-api-client by flagrow logo flagrow

Latest Stable Version Gitter

This is a generic PHP API client for use in any project. You can simply include this package as a dependency to your project to use it.

installation

composer require flagrow/flarum-api-client

configuration

In order to start working with the client you might need a Flarum master key:

  1. Generate a 40 character random, unguessable string, this is the Token needed for this package.
  2. Manually add it to the api_keys table using phpmyadmin/adminer or another solution.

The master key is required to access non-public discussions and running actions otherwise reserved for Flarum administrators.

examples

A basic example:

<?php

require_once "vendor/autoload.php";

use Flagrow\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();

An authorized example:

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

The userId refers to a user that has admin permissions or the user you want to run actions for. Appending the userId setting to the token only works for Master keys.

links

Flagrow is a collaboration of Flarum extension developers to provide quality, maintained extensions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.