Skip to content

chore: Release 1.2.0#20

Merged
nfebe merged 2 commits into
mainfrom
dev
Jul 4, 2026
Merged

chore: Release 1.2.0#20
nfebe merged 2 commits into
mainfrom
dev

Conversation

@nfebe

@nfebe nfebe commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

[1.2.0] - 2026-07-04

Added

  • Installing a plugin now installs the plugin's own declared dependencies into the host application, so packages the plugin relies on are available at runtime instead of failing with class-not-found
  • Local directory paths are a supported install source: plugin:install ./path/to/plugin copies the plugin into place, alongside the existing package-name and repository-URL sources
  • Dependency installation integrates with wikimedia/composer-merge-plugin when the host enables it, and otherwise installs the plugin's requirements directly

nfebe added 2 commits July 4, 2026 13:30
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.
@sourceant

sourceant Bot commented Jul 4, 2026

Copy link
Copy Markdown

Code Review Summary

This PR upgrades the plugin engine to 1.2.0, introducing dependency resolution for plugins, support for local path installations, and integration with composer-merge-plugin.

🚀 Key Improvements

  • Support for installing plugins from local directories.
  • Automatic installation of plugin dependencies into the host application.
  • Abstraction of Composer execution behind a ComposerRunner for testability.
  • Intelligent detection of wikimedia/composer-merge-plugin configuration.

💡 Minor Suggestions

  • Add JSON error handling during composer.json parsing.
  • Standardize path normalization logic.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

return;
}

$manifest = json_decode((string) file_get_contents($composerFile), true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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],

@nfebe nfebe merged commit 77e403c into main Jul 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant