PHP code example of daniieljc / laravel-moodle

1. Go to this page and download the library: Download daniieljc/laravel-moodle 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/ */

    

daniieljc / laravel-moodle example snippets


$client = new RestClient();

$courses = $client->sendRequest('core_course_get_courses', $parameters);

use Daniieljc\LaravelMoodle\Clients\Adapters\RestClient;
use Daniieljc\LaravelMoodle\Connection;
use Daniieljc\LaravelMoodle\Services\Course;
use Daniieljc\LaravelMoodle\Services\User;

class Moodle
{
    protected $client;

    public function __construct()
    {
        $this->client = new RestClient();
    }

    public function getAllClient()
    {
        $service = new User($this->client);
        $users = $service->getAll();
    }

    public function getEnRollUser()
    {
        $service = new Course($this->client);
        $courses = $service->getAll();
        foreach ($courses as $course) {
            $enroll = $service->getCourseEnRolledUser($course->id);
        }
    }
}
bash
php artisan vendor:publish --provider="Daniieljc\LaravelMoodle\LaravelMoodleServiceProvider"