Composer: use fork of yiisoft/yii2 into installation of yii2-app-advanced

I’m trying to use my fork of yiisoft/yii2 into an installation of yii2-app-advanced.

I’ve created a branch custom in my fork following this wiki.

I cannot manage composer to use my fork without braking the dependencies required by other packages of yii2-app-advanced.

My composer.json:

    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Project Template",
    "keywords": ["yii2", "framework", "advanced", "project template"],
    "homepage": "",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "",
        "forum": "",
        "wiki": "",
        "irc": "irc://",
        "source": ""
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.6.0",
        "yiisoft/yii2": "dev-custom",
        "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
        "yiisoft/yii2-bootstrap4": "~2.0.6"
    "require-dev": {
        "yiisoft/yii2-debug": "~2.1.0",
        "yiisoft/yii2-gii": "~2.1.0",
        "yiisoft/yii2-faker": "~2.0.0",
        "codeception/codeception": "^4.0",
        "codeception/module-asserts": "^1.0",
        "codeception/module-yii2": "^1.0",
        "codeception/module-filesystem": "^1.0",
        "codeception/verify": "~0.5.0 || ~1.1.0",
        "symfony/browser-kit": ">=2.7 <=4.2.4"
    "config": {
        "process-timeout": 1800,
        "fxp-asset": {
            "enabled": false
    "repositories": [
            "type": "composer",
            "url": ""
            "type": "vcs",
            "url": ""

When I run composer update I get the following error:

Your requirements could not be resolved to an installable set of packages.

      Problem 1
        - The requested package yiisoft/yii2 dev-custom exists as yiisoft/yii2[2.0.0, ..., dev-master, 2.0.x-dev] but these are rejected by your constraint.

Instead of using "yiisoft/yii2": "dev-custom" I tried to use "yiisoft/yii2-dev": "dev-custom" since yiisoft/yii2-dev is the name of the package yiisoft/yii2. In that case I get several errors because other packages depends on yiisoft/yii2:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Removal request for yiisoft/yii2 == 2.0.9999999.9999999-dev
    - yiisoft/yii2-gii 2.1.4 requires yiisoft/yii2 ~2.0.14 -> satisfiable by yiisoft/yii2[2.0.x-dev, ,,,, 2.0.32].

What is the right way to test and use custom forks of yiisoft/yii2?

The issue is about using a branch. It is considered an unstable version and that doesn’t match "minimum-stability": "stable". There are two ways fixing it:

  1. Tag a version in your fork.
  2. Use "yiisoft/yii2": "dev-custom@dev".

I’d try second way first.

btw., why do you need a fork?

I’m using a fork because I want to learn how to handle the test and development using forks.

A general procedure is suggested in this workflow but in real practice I was missing how to include my modifications in a complete project.

I have found a workaround for a small issue that I noticed (in yiisoft/yii2) and I’m trying to find a way to test it properly.

Regarding the answer, I tried to use "yiisoft/yii2": "dev-custom@dev" (the second way suggested) and it works fine!

Meanwhile I came up with an alternative method that is working as well. In the composer.json of my fork I added an alias pointing to my branch:

"extra": {
    "branch-alias": {
        "dev-master": "2.0.x-dev",
        "dev-custom": "2.0.n-dev"

(Worth noticing, in the label 2.0.n-dev n is a random number I just tried)

Then in the composer.json of my yii2-advanced project I used "yiisoft/yii2": "2.0.n.x-dev".

The reason why I need to use "2.0.n.x-dev" instead of "2.0.n-dev" is probably explained here.

I’m upgrading a yii2 project to PHP8.2
I see that the latest release of Yii is 2.0.47 which isn’t ready for PHP8.2
There is a branch php82
I want to use the php82 branch, and if I find any problems I can help out with a pull request.

I’ve forked github yii2
created new branch dev-php82
updated composer.json:

"repositories": [
        "type": "git",
        "url": ""
"require": {
    "php": ">=8.2.1",
    "yidas/yii2-bower-asset": "~2.0.5",
    "yiisoft/yii2": "dev-php82@dev",

run composer update:

  • Root composer.json requires yiisoft/yii2 dev-php82@dev, found yiisoft/yii2[dev-master, 2.0.0-alpha, …, 2.1.x-dev, 3.0.x-dev] but it does not match the constraint.