phpgitcomposer-php

The requested package ... could not be found in any version


When I want to require my project, the following errors shows up:

The requested package mvc-php/framework could not be found in any version, there may be a typo in the package name.

The "mvc-php/framework" is a git folder.

{
    "name": "mvc-php/app",
    "repositories": [
        {
            "type": "path",
            "url": "/Users/youri/Documents/Github/framework"
        }
    ],
    "require": {
        "php": ">=7.0",
        "mvc-php/framework": "master"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        }
    }
}

Project i want to require:

{
    "name": "mvc-php/framework",
    "description": "PHP MVC framework",
    "autoload": {
        "psr-4": {
            "Mvc\\" : "src/"
        }
    },
    "require": {
        "php": ">=7.0"
    }
}

Solution

  • Instead of just the branch name, you must require branchName@dev

    https://getcomposer.org/doc/articles/versions.md#branches

    {
        "name": "mvc-php/app",
        "repositories": [
            {
                "type": "path",
                "url": "/Users/youri/Documents/Github/framework"
            }
        ],
        "require": {
            "php": ">=7.0",
            "mvc-php/framework": "master@dev"
        },
        "autoload": {
            "psr-4": {
                "App\\": "app/"
            }
        }
    }