LoginSignup
1
1

More than 5 years have passed since last update.

composerでforkしたリポジトリの新しいバージョンを使用する

Posted at

公式リポジトリがメンテナンスされていないので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-firebasedependenciesphp-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.80.7として扱う事ができました。

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1