I had to integrate a Laravel application with a Moodle instance: certain users, under given circumstances, may generate a new course in Moodle, be enroled as teacher, and add other platform's users as students.
The first step has been to setup a unified authentication, implementing a OAuth2 server in Laravel