InterNACHI / modular

Modularize your Laravel application
MIT License
788 stars 65 forks source link

Best way to extract a module to be used in multiple projects? #83

Closed RishabSwift closed 7 months ago

RishabSwift commented 7 months ago

Loving this package so far!

Is there a convention or suggested method to "extract" a module and while symlink is still there for instant development?

Scenario: Supposed I have a "TODO Checklist" module in Project A. Now I want to have the same module in Project B.

  1. How can I extract the module such that it can be "extracted" and "linked" to both Project A and Project B? Moreover, how can it be done in a way where if I make changes to the module, it will immediately be reflected in both projects without doing like composer update or something similar.
  2. When deploying it using say Laravel Forge, how can I reference the same module in both projects? Would it be a private composer repository stored in git?

Thank you so much

Wulfheart commented 7 months ago

What do you mean without composer update? In dev mode or in prod mode?

inxilpro commented 7 months ago

It's a bit of a manual process—maybe I can document it better. Basically, if you want to extract a module out as a package, you're going to lose the auto-discovery, so you'll have to redo all that yourself. So you'd copy all the files to a new git repo and then register your views/commands/etc in your service provider. Then you can use a "path" repository to link to your local copy for local development.