-
Notifications
You must be signed in to change notification settings - Fork 331
Add VendorModuleService for Composer-based Webtrees modules #5227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Together with Webtrees 2.2.4 or dev-main, this can currently be tested using the magicsunday/webtrees-fan-chart package, for example. To do this, the WIP branch must be checked out.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5227 +/- ##
============================================
- Coverage 34.96% 34.92% -0.04%
- Complexity 11228 11245 +17
============================================
Files 1159 1160 +1
Lines 48235 48293 +58
============================================
+ Hits 16865 16868 +3
- Misses 31370 31425 +55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I develop modules purely for my own use. I have no need or interest in using composer. I know there are many others doing the same. For us modules_v4 is simple and works well. So how does this proposal affect us? There is no mention of users like us in this. |
|
Thanks for raising this — it’s an important point. To be clear: this proposal does not remove or break the existing What this PR does is add an additional option for distributing and installing modules via Composer, using the new
So to summarize:
The goal here is to expand possibilities without taking anything away. |
|
Hi @fisharebest, I hope you're well. I'd appreciate it if you'd take a look at this PR. If you find any issues, I'm happy to adjust or improve it. Thank you for your time and feedback! |
|
Nice work! |
|
Thanks for the kind feedback! Let me clarify: What steps are needed to publish a module?
That’s it — Composer takes care of the rest (autoloading, versioning, installation path, etc.). Does this add more dependencies for webtrees?
So in short:
|
|
As I understand it, this approach will complicate things tremendously for site admins that 'simply' want to install or try out a vendor module. Currently all that's needed is unzip the module source code into a subdirectory of With this mechanism they need to clone the webtrees git repo, edit some file, have a local PHP development environment in order to execute Thus the requirements for using such modules are raised significantly. Or am I missing something? |
|
Hi @BertKoor |
|
Thanks for pointing that out, @kiwi3685 . I thought I had read the complete discussion, but apparently I had misunderstood some nuances. You addressed concerns from the point of view of a module developer. It was mentioned that this "does not remove or break the existing Now should I understand that "composer"-ised modules can be installed the old way as well? In my experience more options leads to confusion, especially on unknown territory. And I hope that n>1 for this feature, but I have my doubts. |
@fisharebest |
Add
VendorModuleServicefor Composer-based Webtrees modules🚀 Feature: Vendor Module Support via Composer (
VendorModuleService)Overview
This PR introduces a new service class,
VendorModuleService, that allows Webtrees to seamlessly load modules installed via Composer.A key part of this feature is the introduction of a new Composer package type:
webtrees-module. This package type signals that a Composer package is a Webtrees extension, making it automatically discoverable and loadable by the Webtrees core.This modernizes module management and brings Webtrees closer in line with practices used by frameworks such as Symfony, Laravel, and TYPO3.
Why?
Currently, Webtrees modules are installed and managed manually in the
modules_v4directory. While functional, this approach has limitations:By enabling Composer-managed modules (via
webtrees-module), we provide:composer require vendor/package)This makes Webtrees more attractive to external developers and lowers the barrier for creating and sharing extensions.
How It Works
The
VendorModuleServiceleverages Composer’s InstalledVersions API to:webtrees-modulemodule.phpentrypointModuleServiceFlashMessagesInternally:
composer.json→"type": "webtrees-module"_mypackage_)Benefits
📦 Example
composer.jsonfor a Webtrees Module{ "name": "my-vendor/my-webtrees-module", "description": "An example Webtrees module distributed via Composer.", "type": "webtrees-module", "license": "GPL-3.0-or-later", "authors": [ { "name": "Your Name", "email": "[email protected]" } ], "require": { "php": ">=8.1", "fisharebest/webtrees": "^2.2" }, "autoload": { "psr-4": { "MyVendor\\MyWebtreesModule\\": "src/" } } }