Code Monkey home page Code Monkey 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.

flarum-api-client's People

Contributors

luceos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flarum-api-client's Issues

Authorised example in README is wrong

It should be like this (notice the "Token " string before the token).

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

Update composer.json requirements

An upgrade of the composer.json requirements would be desired to be able to install this extension on Laravel 6.x or 7.x. Currently illuminate/support and illuminate/cache block any updates above Laravel 5.8.

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.