laravel-moodle maintained by cadix

[[TOC]]
Installation
Run the command below to install the package:
composer require cadix/laravel-moodle
Config
Run the command below to publish the configuration or override the config in your .env file.
php artisan vendor:publish --provider="Cadix\LaravelMoodle\LaravelMoodleServiceProvider" --tag="config"
| env | Default | Description |
|---|---|---|
| MOODLE_HOST | null | Base URI |
| MOODLE_TOKEN | null | Token from Moodle |
| MOODLE_URI | "${MOODLE_HOST}/moodle/webservice/rest/server.php?wstoken=${MOODLE_TOKEN}&moodlewsrestformat=json&wsfunction=" | Should be complete URI from which methods can be run |
Read the docs on how to get a token.
Available methods
Note not all methods might be available to you. Check your Moodle version and the provided methods to see if you can use a method. We aim to be compatible with the latest LTS version according to Moodles lifecycle.
Auth
| Method | Version | |
|---|---|---|
| auth_email_signup_user | ^3.2 | *Only available when users are allowed to register |
| create | wrapper for auth_email_signup_user |
|
| core_auth_request_password_reset | ^3.4 | |
| core_auth_resend_confirmation_email | ^3.6 | *Only for unconfirmed users |
Course
| Method | Version | |
|---|---|---|
| core_course_get_courses | ^2.0 | |
| core_course_get_courses_by_field | ^3.2 |
Enrol
| Method | Version | |
|---|---|---|
| core_enrol_get_enrolled_users | ^2.1 | |
| core_enrol_get_users_courses | ^2.0 | |
| enrol_manual_enrol_users | ^2.0 |
User
| Method | Version | |
|---|---|---|
| core_user_create_users | ^2.0 | |
| core_user_delete_users | ^2.0 | |
| core_user_exists | own method | Will check if a user exists; returns bool |
| core_user_first_or_create | own method | Will check if a user exists based on email and or username; returns created or found user |
| core_user_get_users | ^2.5 | |
| core_user_get_users_by_field | ^2.5 | |
| core_user_update_users | ^2.0 |