Skip to content

feat(install): Install plugin dependencies on URL and path installs#18

Merged
nfebe merged 1 commit into
devfrom
feat/install-plugin-dependencies
Jul 4, 2026
Merged

feat(install): Install plugin dependencies on URL and path installs#18
nfebe merged 1 commit into
devfrom
feat/install-plugin-dependencies

Conversation

@nfebe

@nfebe nfebe commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Closes #17.

plugin:install from a repository URL or a local path placed the plugin and ran
discovery, but never installed the dependencies the plugin declares in its own
composer.json. The plugin's own classes loaded; its dependencies did not, so
anything it pulled in (an SDK, a parser) failed with class-not-found at runtime.

The install now reads the placed plugin's composer.json and installs its
require into the host. Platform constraints (php, ext-*, lib-*) are
skipped, and any repositories the plugin declares are registered first so the
requires can resolve.

Local directory paths are also a first-class install source now. Previously a
non-URL argument was always treated as a Composer package name, so
plugin:install ./path/to/plugin never worked.

Where the host opts into wikimedia/composer-merge-plugin for its plugins
directory, the install runs a targeted composer update so each plugin keeps
owning its dependencies; otherwise it falls back to composer require. The
Composer call sits behind a small runner interface, so dependency installation
is covered by tests without shelling out.

@sourceant

sourceant Bot commented Jun 30, 2026

Copy link
Copy Markdown

Code Review Summary

This PR significantly improves the plugin:install command by adding support for local path installations and automatic dependency resolution via Composer. It introduces a clean abstraction for running Composer commands, facilitating easier testing.

🚀 Key Improvements

  • Added support for installing plugins from local directories.
  • Implemented automatic installation of plugin dependencies found in composer.json.
  • Added support for wikimedia/composer-merge-plugin detection to maintain proper dependency ownership.
  • Introduced ComposerRunner interface for better testability.

💡 Minor Suggestions

  • Consider using the File facade instead of file_get_contents for consistency and mockability.
  • Ensure repository configuration success is verified before attempting to install packages.

@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.

Comment thread src/Console/Commands/InstallCommand.php Outdated
Comment thread src/Console/Commands/InstallCommand.php Outdated
@nfebe nfebe force-pushed the feat/install-plugin-dependencies branch from 3804580 to aa1f9b0 Compare July 4, 2026 11:33
@nfebe nfebe changed the base branch from main to dev July 4, 2026 11:33

@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.

Comment thread src/Console/Commands/InstallCommand.php
Comment thread src/Console/Commands/InstallCommand.php
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.
@nfebe nfebe force-pushed the feat/install-plugin-dependencies branch from aa1f9b0 to 8c1b1e3 Compare July 4, 2026 11:35

@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.

Comment thread src/Console/Commands/InstallCommand.php
Comment thread src/Console/Commands/InstallCommand.php
@nfebe nfebe merged commit 69b897b into dev Jul 4, 2026
1 check passed
@nfebe nfebe mentioned this pull request Jul 4, 2026
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.

feat: Install Command does not install dependencies for URL or path installations

1 participant