公式リポジトリがメンテナンスされていないのでforkされた新しいリポジトリを使いたいとき。
composer.jsonのrepositories
にforkされた新しいリポジトリを追加すると新しいリポジトリを参照してくれます。
composer.json
"repositories": [
{
"type": "vcs",
"url": "git@github.com:MatthewPattell/php-fcm.git"
}
],
"require": {
"grohiro/laravel-firebase": "1.0.1",
"paragraph1/php-fcm": "0.8"
}
ここで別のパッケージ grohiro/laravel-firebase
が dependencies
で php-fcm
のバージョン0.7
を参照しているとバージョン不一致でエラーになります。
Problem 1
- grohiro/laravel-firebase 1.0.1 requires paragraph1/php-fcm ^0.7.0 -> satisfiable by paragraph1/php-fcm[0.7] but these conflict with your requirements or minimum-stability.
- Installation request for grohiro/laravel-firebase 1.0.1 -> satisfiable by grohiro/laravel-firebase[1.0.1].
自分が要求しているのが php-fcm@0.8
、laravel-firebaseパッケージが要求しているのは php-fcm@0.7
です。
ここでバージョンを 0.8
に上げても問題ないなら上書きしてしまいましょう。
require
のバージョン指定で as
を使用するとバージョンに別名を付ける事ができます。
"require": {
"grohiro/laravel-firebase": "1.0.1",
"paragraph1/php-fcm": "0.8 as 0.7"
}
これでバージョン0.8
を0.7
として扱う事ができました。