caffeinated / modules

:package: Modules package for Laravel
https://caffeinatedpackages.com
MIT License
955 stars 230 forks source link

Installable module #359

Closed nasirkhan closed 5 years ago

nasirkhan commented 6 years ago

Is there any way to make a module installable, something like packages? if so what are the steps to do that, any doc available?

illuminate3 commented 6 years ago

I have been wanting this for a while. So something like October CMS or more famously Word Press correct? I am still doing research on this and most people don't really say how they did it.

I think it is a combination of composer/installers and using satis as your repository. You will possibly need to register with composer/installers for your own setup but you probably could use a preset type like asgard:modules.

I was able to use composer/installers from a regular github repo to pull my module into the Modules directory. I am still trying to figure out the admin controller side to do this. I really would like to be able to pull down a list of available modules and let users install their own modules with having to run composer from the command line.

I hope this helps and would appreciate if you get further to let me know how you went about it.

nasirkhan commented 6 years ago

@illuminate3 Do you have any which explains how the Asgard CMS works, like how can i build an application which can be used to supports modules?

illuminate3 commented 6 years ago

Asgard uses their own module system. I prefer the simplicity of Caffeinated modules.

Asgard uses composer/installer ( https://github.com/composer/installers ) and then sets the type. Asgard has a module called workbench which lists and let's you enable/disable the modules but you have to install several other modules too. Building a workbench like module based on Caffeinated is not that hard.

But like you, I am still looking for system that let's me get a list of supported modules, download them and install them. This API side is what led me to look into Satis ( https://composer.github.io/satis/ ).

Sadly, I haven't had time to progress beyond this point because I can't get Caffinated to move config files with vendor:publish with laravel 5.6. Road block.

Like i said before, you might want to look into October cms and see how they do it. I have been looking for a package to do the API side but haven't seen anything.

Before, with laravel 5.1. I used the merge-plugin and then just used composer to call my modules. it wasn't fancy. It just sorted my code into logical units (modules) instead of creating packages in the vendor directory. So, don't over think it!

How far have you got and what kind of discovery have you made?

nasirkhan commented 6 years ago

Asgard Usage the https://github.com/nWidart/laravel-modules package for building modules. Each module can be a separate composer package and you can install from the terminal (though it requires an another package to do that). For updating those individual packages composer-merge-plugin could be an option though i have not tried that yet.

I was searching for a install/uninstall option for Caffeinated module but did not find any and that is the reason of crating this issue.

Satis is the best option to maintain private packages and there is an another approach named VCS Repo

illuminate3 commented 6 years ago

We are on the same page here I think.

I haven't found a module package that allows direct install without having that module already in composer or using composer required from the command line. You would have to create a function that finds the modules (why I suggested satis) and then run php artisan from within a function to composer require it. I still haven't had a chance to install Satis so I am not familiar with what kinds of APIs can be built.

I am porting https://github.com/rappasoft/laravel-5-boilerplate into a module system at the moment. Almost done but have an issue with moving the USER model into a module. I will link back after I sort that out or if I give up tonight I will just push to my github account. Either way, I will let you know.

nWidart commented 6 years ago

@nasirkhan nwidart/laravel-modules does not require another package to install a module. There is a module:install command which can install a module from git (ie no composer needed), composer, and subtree. Even without using this, you can use simple composer to install modules. You probably have composer already so I don't think it counts as another package.

It's very easy to have private packages if you know composer and its plugin system.

nasirkhan commented 6 years ago

@nWidart thanks for mentioning the command module:install. I did not find anything related to that and also on publishing module page you mentioned the package joshbrw/laravel-module-installer. Can you please revisit the doc and update if necessary.