Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

uzairkhalil's avatar

Seeking Advice on Designing a Laravel Plugin Installer

Hi, I'm seeking recommendations for designing a Laravel Plugin Installer solution. My objective is to create a platform within my Laravel application allowing users to install plugins by uploading zip files containing code for new features. It's crucial to note that developing a Composer package isn't a viable solution as users must install the new feature plugins via a user interface, similar to the WordPress plugin installation process. Any insights or guidance on designing such a system effectively and efficiently would be greatly appreciated.

0 likes
7 replies
gych's avatar

A plugin could work similar as a module. When the plugin is uploaded as zip, extract it and add to a plugins folder. Add database record and an option to enable and disable the plugin.

1 like
uzairkhalil's avatar

@gych But how the plugin will be accessed from the plugins folder? Plugin will contain controllers, models, views or any other involving files.

gych's avatar

@uzairkhalil What will the plugin contain then to add the feature to the application ? What kind of features will be added with a plugin ?

uzairkhalil's avatar

@gych So far the solution I have designed that will place new feature files i.e. controllers, models, views, etc. files in a zip file with the exact structure of the Laravel project structure. For example, if my new feature contains a controller file, it will be placed in the plugin zip file as "app\Http\Controllers\NewFeatureController.php". So, the installer will first extract the zip file in a temporary folder in storage and then will move the files to the destination from which the relative path it is copied like with the same example, copied from storage temp "app\Http\Controllers\NewFeatureController.php" to application "app\Http\Controllers". I have executed some successful tests with this procedure but I don't it is the most effective one.

My client wants the same plugin installer here in the Laravel application.

What kind of features will be added with a plugin? Let me explain this in a bit more detail too, I am developing e-commerce API web applications like Amazon, eBay, Shopify, etc. So I can't install all apps in one Laravel application at once and sell. A customer just needs 3 or 4 apps out of hundreds. So, whichever app they will need, they will purchase.

martinbean's avatar

@uzairkhalil You’re over-complicating the problem. How a “plugin” is installed shouldn’t dictate how the plugin code itself is written. As I’m sure WordPress plugins will need to follow a particular directory structure and use some sort of manifest file to declare information about itself such as name, version, etc.

All an installer is going to do is fetch some data from some URL, and then save that to some directory. That’s it. So just make your installer fetch a ZIP of the plugin, save it to a directory, and then extract the archive. Your next step is then defining a structure on how your main application “detects” these plugins. Most obviously solution to me would be a service provider that acts as the plugin’s “hook” or entry point.

1 like
uzairkhalil's avatar

@martinbean Absolutely! My solution is almost the same, but this introduces something new I'm planning to implement in Laravel. Therefore, I'm open to opinions in case I might be overlooking something basic.

Please or to participate in this conversation.