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"     } } 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/"         }     } } The requested package X/Y could not be found in any version.
The requested package needs to be a git folder with the committed and existing composer.json file. Then to reference specific branch, you need to add the dev- prefix, so dev-master, not master.
Here is the minimal working example:
File: composer.json
{   "require": {     "local/my_package": "dev-master"   },   "repositories": [     {       "packagist.org": false     },     {       "type": "path",       "url": "my_package/"     }   ] } File: my_package/composer.json
{   "name": "local/my_package",   "require-dev": {     "symfony/console": "*"   } } Note: Above file is under local Git repository. To create one, run: git init && git commit -am 'Files'.
To troubleshoot the issue, run:
composer install -vvv Also consider running: composer diagnose to identify common Composer errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With