magicsunday / webtrees-module-installer-plugin
A Composer plugin installer for directly installing webtrees modules into its modules_v4 directory.
Installs: 7 021
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:composer-plugin
Requires
- php: >=8.2.0 <8.5.0
- composer-plugin-api: ^2.6
Requires (Dev)
- composer/composer: ^2.8
- friendsofphp/php-cs-fixer: ^3.85
- overtrue/phplint: ^9.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- rector/rector: ^2.0
README
A powerful Composer plugin that simplifies the installation of modules for the webtrees genealogy application by automatically placing them in the correct directory structure.
๐ Seamless Integration
Automatically installs webtrees modules to the correct modules_v4
directory without manual file copying.
โ๏ธ Easy Configuration
Simple setup with minimal configuration required in your composer.json file.
๐ Why Use This Plugin?
When developing or using modules for webtrees, managing the installation process can be cumbersome. This plugin solves that problem by:
- Automatically detecting and installing modules with the
webtrees-module
type - Placing modules in the correct
modules_v4
directory structure - Supporting both direct installation and installation via a separate composer.json
- Eliminating the need for manual file copying or symlink creation
๐ Requirements
System Requirements
- PHP 8.2 or higher (compatible up to PHP 8.4)
- Composer 2.6 or higher
๐ง Installation
Add this plugin to the require
or require-dev
section of your composer.json
file:
"require": { "magicsunday/webtrees-module-installer-plugin": "^1.6" },
Or install it using Composer:
composer require magicsunday/webtrees-module-installer-plugin
Make sure to allow the plugin in your composer.json:
"config": { "allow-plugins": { "magicsunday/webtrees-module-installer-plugin": true } }
๐ฆ Usage
For Module Users
To install a webtrees module with composer, simply require the module in your composer.json:
composer require vendor-name/module-name
The plugin will automatically install the module to the modules_v4
directory.
For Module Developers
When creating a webtrees module, set the package type to webtrees-module
in your module's composer.json:
{ "name": "your-vendor-name/your-module-name", "description": "Your module description", "type": "webtrees-module", "require": { "php": ">=8.2.0" } }
Pro Tip
The module name in the composer.json file will determine the directory name in the modules_v4
directory.
Installing from GitHub
If your module is not listed on Packagist, you can install it directly from GitHub:
composer config repositories.your-repo-name vcs https://github.com/your-vendor-name/your-module-name composer require your-vendor-name/your-module-name[:optional-branch-name]
For example, to install the dev-master branch:
composer require your-vendor-name/your-module-name:dev-master
๐งช Testing
The plugin includes several testing tools to ensure code quality:
# Run all tests composer ci:test # Run specific tests composer ci:test:php:phpstan # Static analysis composer ci:test:php:lint # PHP linting composer ci:test:php:rector # Code quality checks composer ci:test:php:cgl # Coding guidelines
๐ How It Works
The plugin works by:
- Registering a custom installer with Composer's installation manager
- Detecting packages with the
webtrees-module
type - Determining the correct installation path in the
modules_v4
directory - Handling both direct installation and installation via a separate composer.json
The main components are:
ModuleInstallerPlugin
: Implements Composer's PluginInterfaceModuleInstaller
: Extends Composer's LibraryInstaller to handle module installationConfig
: Manages configuration settings and path resolution
๐ฅ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please make sure your code follows the project's coding standards by running the tests before submitting.
๐ License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.