Conversation
Installing a plugin from a repository URL or a local path now resolves the dependencies the plugin declares in its own composer.json, so its classes are available at runtime instead of failing with class-not-found errors. Local directory paths are now a supported install source alongside URLs and Composer package names. When the host application merges plugin manifests via composer-merge-plugin the install runs a targeted update; otherwise it falls back to requiring the declared packages, letting Composer resolve them against the host constraints.
Bumps the package to 1.2.0 with changelog entries for installing a plugin's own dependencies into the host and for local directory paths as an install source.
Code Review SummaryThis PR upgrades the plugin engine to 1.2.0, introducing dependency resolution for plugins, support for local path installations, and integration with 🚀 Key Improvements
💡 Minor Suggestions
|
| return; | ||
| } | ||
|
|
||
| $manifest = json_decode((string) file_get_contents($composerFile), true); |
There was a problem hiding this comment.
When decoding JSON, you should check if json_decode returned null and if a JSON error occurred to handle malformed files gracefully.
Suggested change
| $manifest = json_decode((string) file_get_contents($composerFile), true); | |
| $manifest = json_decode((string) file_get_contents($composerFile), true); | |
| if (json_last_error() !== JSON_ERROR_NONE || ! is_array($manifest)) { |
| // Register any repositories the plugin declares (VCS, path, ...) so its | ||
| // requires can be resolved against them. | ||
| foreach (($manifest['repositories'] ?? []) as $name => $repository) { | ||
| $repoName = is_string($name) ? $name : 'plugin-'.substr(md5(json_encode($repository)), 0, 8); |
There was a problem hiding this comment.
Using json_encode without JSON_THROW_ON_ERROR can return false on failure. It is safer to ensure it succeeds before using it in a hash or command line.
Suggested change
| $repoName = is_string($name) ? $name : 'plugin-'.substr(md5(json_encode($repository)), 0, 8); | |
| $repoJson = json_encode($repository, JSON_THROW_ON_ERROR); | |
| $repoName = is_string($name) ? $name : 'plugin-'.substr(md5($repoJson), 0, 8); | |
| $this->composer->run( | |
| ['composer', 'config', '--no-interaction', 'repositories.'.$repoName, $repoJson], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[1.2.0] - 2026-07-04
Added
plugin:install ./path/to/plugincopies the plugin into place, alongside the existing package-name and repository-URL sourceswikimedia/composer-merge-pluginwhen the host enables it, and otherwise installs the plugin's requirements directly