Composer/ja

Composer (コンポーザー) は、PHPのライブラリの依存性管理ツールです. 以降、MediaWikiコアの外部ライブラリの依存関係はComposerで管理されるようになりました. さらに、MediaWiki拡張機能のインストールの管理にも使用できます(以降で利用できます). しかし、現状ではあまりサポートされていません. 今後、変更される可能性があります.

Unix/Linux、macOSの場合
install Composerには、最もわかりやすい方法である の他に、複数の方法があります.

MediaWiki 1.31、1.35.0、1.35.1では、Composer 1.xのみサポートされています. 最新のComposer 1.x安定版リリースを入手するには以下を実行します:

Composer 2.xとComposer 1.xはMediaWiki >= 1.35.2(REL1_36 ブランチとmasterとともに)でサポートされています. 最新のComposer 2.x安定版リリースを入手するには以下を実行します:

macOSをお使いの方は、Homebrewを使ってComposerをインストールすることができます. Note this will install version Composer 2.x, so depending on the version of MediaWiki you are using, you may need to follow the  instructions above instead to download Composer 1.x. To install using  :

動作しない場合、または Homebrew がインストールされていない場合は、以下をお試しください:

Toolforge and the extension distributor use the copy of Composer contained in the "integration/composer" git repo.

Composer をインストールすると、ダウンロードした phar 経由で以下のようにコマンドを実行できるようになります:

phar をパスが通っている場所に移動すると、通常の実行可能ファイルと同様に使用できます:

mv コマンドが権限が原因で失敗した場合は、sudo を付けてもう一度お試しください.

Windows 上
Just download and run the installer from the download page. If you prefer manual installation, you can follow the above steps except that Windows doesn’t have wget (or APT or Homebrew) by default, and there is no /usr/local/bin directory. In these cases, you can just download composer-1.phar in your web browser and then rename it to composer.phar.

Composer 1.x
If you want to upgrade Composer to the latest 1.x stable (or downgrade from 2.x stable), you can use:

If the update command fails due to permissions, execute it again with sudo.

If you are on a really old version of composer, it may not have the  parameter. In this case, you might want to run  twice. The first may update it to 2.x, so the second will downgrade it to the latest version of 1.x.

Composer 2.x
If you are using Composer 1.x, and want to upgrade to Composer 2.x (and are using an appropriate version of MediaWiki, such as >= 1.35.2), you can use:

If the update command fails due to permissions, execute it again with sudo.

MediaWiki コアでの使用法
MediaWiki 1.25 以降は、Composer で管理されているいくつかの外部ライブラリに依存しています. Composer は、 によってインクルードされる自動ローダーを   に作成します.

Composer managed dependencies are bundled into tarball distributions of MediaWiki and extensions so system administrators do not need to use Composer directly. When installing MediaWiki using Git, dependencies declared in  can either be installed locally by running   or the   repository can be cloned to provide the same libraries used on the Wikimedia production cluster.

composer-merge-plugin の使用
MediaWiki core "owns"  and will change the contents of that file in both tarball and Git managed updates. In order to allow local installs to use Composer to load optional libraries and/or manage extensions with Composer, a special plugin for Composer named composer-merge-plugin was developed. This plugin and the MediaWiki core  configuration allow a local deployment to add required extensions and libraries to a file   inside the root MediaWiki directory.

can also be used to install Composer managed libraries that are needed by extensions that are not installed using Composer themselves. This is only needed when the extensions are not installed from tarballs generated by Extension Distributor.

To enable Composer to discover and process the  files that may be included in any and all of your locally installed extensions, add something like this to  :

After any changes to, you need to remove   before running   again so that Composer will recalculate the dependencies and the changes will take effect.

リソース

 * List of extensions that can or must be installed with Composer
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)
 * Composer (software)