Download the PHP package warnax-corp/moodlerest without Composer
On this page you can find all versions of the php package warnax-corp/moodlerest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download warnax-corp/moodlerest
More information about warnax-corp/moodlerest
Files in warnax-corp/moodlerest
Package moodlerest
Short Description MoodleRest is a PHP class to query Moodle REST webservices
License MIT
Homepage https://github.com/warnax-corp
Informations about the package moodlerest
MoodleRest
MoodleRest is a PHP class to query Moodle REST webservices. You can make GET and POST requests.
Quick start
Ensure you already have access to a Moodle webservice. To use this class you will need a token (generated by Moodle admin) with the necessary capabilities for the services you want to access.
IMPORTANT
If you need a detailed explanation about the $parameters format of the request() method, [read it in wiki](https://github.com/llagerlof/MoodleRest/wiki/Understanding-the-$parameters-in-request()-method).
To the code
You have 2 options to add this lib to your project:
Option One: Use Composer to include it in your project.
-
Inside your project directory create or modify the file
composer.json
: -
In the same directory of the
composer.json
, run: - In your project, load the lib using composer autoloader:
Option Two: Include the MoodleRest.php class in your script.
Example 1
Query 2 Moodle groups with IDs 1 and 2, passing the server URL and token in constructor.
Example 2
Set the server and token in constructor and make a request to create a group on Moodle.
Example 3
Query 2 pre-existent Moodle groups with IDs 1 and 2 (like example 1, without setting the server and token values in constructor).
Example 4
Make a request using chained methods and return the result as json.
More examples in wiki.