Moodle Plugin as standalone PHP app

Moodle Plugin as standalone PHP app

by Chandra R -
Number of replies: 5

Dear all,

I support Moodle installations at some of our state-run schools in south India, and am just embarking on developing a plugin for a custom requirement that has come up. I have not developed a plugin before, but have robust programming experience and am reviewing the plugin development guidelines right now.

To experienced PHP/plugin folks on the forum:

I would like to know how easy it is - from a code design perspective - to expect to keep the core functionality Moodle-free and make the functionality Moodle-pluggable in a very modular way. The reason I ask is that I would like to be able to also deploy the plugin's functionality as a standalone PHP webapp in schools that do not use Moodle, and obviously its not a great idea to have two codebases - one for the plugin, and one for the standalone PHP webapp. I understand there will always be Moodle-specific parts in my code and I need to put in the effort to modularize code, but to begin with,  is it realistic to aim to develop the plugin in a way where I can neatly build the same codebase both as a plugin and a PHP webapp? Are there any examples of existing plugins that are also available as standalone apps?

Any pointers and guidance from your experience is highly appreciated. Thank you!

PS: I guess my question comes from a background where I have worked on platforms that simply enforced such tight coupling with the plugins that for all practical purposes, a separate codebase with a lot of duplicate code was required to develop a PHP app with the same functionality.

Regards,

Chandra

Average of ratings: -
In reply to Chandra R

Re: Moodle Plugin as standalone PHP app

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hello there - just moving this to the General developer forum...
In reply to Chandra R

Re: Moodle Plugin as standalone PHP app

by Dominique Palumbo -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi,

One way it's to use LTI possibility. You'll have to adapt your application but it's not that much.
https://docs.moodle.org/401/en/External_tool

You've good php library to manage LTI 1.3 : https://github.com/celtic-project/LTI-PHP
You can easily manage LTI 1.0 without library but it's deprecated.

If you've to interact more with moodle you can also use web services.

I hope it's helped.

Have a nice day.

Dominique.
In reply to Chandra R

Re: Moodle Plugin as standalone PHP app

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think it is going to prove difficult to develop a Moodle plugin without using a lot of other Moodle code (e.g. the Moodle forms library, the rendering system to display templates, etc.) Moodle also takes care of lots of other stuff that you would have to handle yourself in a stand-alone application: autenticating users, controlling which users can access which activity, etc.

Dominique pointed out that you could develop your plugin as a stand-alone application, then include it in Moodle using LTI.

The other option is also possible. That is, if you develop your activity as a Moodle plugin, then you can use Moodle as an LTI provider, to allow the activity to be used from other LMSs.
Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Moodle Plugin as standalone PHP app

by Chandra R -
Dear Tim, Dominique, Many thanks for your suggestions and taking the time to do so. More or less decided we will take the LTI route, likely developing a stand-alone LTI compliant application. Thanks again!
Average of ratings: Useful (1)
In reply to Chandra R

Re: Moodle Plugin as standalone PHP app

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
If you develop with with LTI it could (in theory) work with systems other than Moodle. But we wouldn't want you to do that smile