Haris Mehmood Haris Mehmood - 1 month ago 7
JSON Question

Composer not installing dependencies of Package

I have two projects. One is my

application
and the second one is an
external module
that I want to use in future apps.

I have created my external module on GitHub and included in the
composer.json
of my application.

My
external module
gets downloaded / cloned but the
required dependencies are not installed by composer
.

Here's composer.json of my application:

{
"name": "application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "2.*",
"zf-commons/zfc-user": "1.4.4",
"doctrine/doctrine-orm-module": "~0.9.2",
"zf-commons/zfc-user-doctrine-orm": "1.0.*",
"zendframework/zend-developer-tools": "^0.0.2",
"username/GlideUser": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/username/GlideUser.git"
}
]
}


Here's composer.json of my external module:

{
"name": "username/glide-user",
"description": "Module For Zend Framework 2",
"type": "library",
"license": "BSD-3-Clause",
"homepage": "https://github.com/username/GlideUser",
"keywords": [
"zf2",
"zfc-user",
"bjyauthorize"
],
"authors": [
{
"name": "Haris Mehmood",
"email": "abc@outlook.com",
"homepage": "abc.com",
"role": "Developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.3.3",
"bjyoungblood/bjy-authorize": "1.4.0"
},
"autoload": {
"psr-0": {
"GlideUser\\": "src/"
}
}
}


When I run composer install or composer update I expect bjyauthorize package to gets installed, but composer ignore the dependency and install everything else.

What is it that I am doing wrong here.

Answer

Try updating the following line in your application composer.json from:

"username/GlideUser": "dev-master"

to:

"username/glide-user": "dev-master"

This way, what is being required matches the name of the external module, which is the name defined inside the external module's composer.json.

Although it does not look directly applicable to the dependencies of the external module not installing, it could be the cause.