Rob
Rob

Reputation: 127

Composer won't install package dependencies

I have created composer package, which composer.json is

{
    "name": "xxxx/yyyyy",
    "description": "xyz",
    "license": "MIT",
    "authors": [
        {
            "name": "xxx",
            "email": "[email protected]"
        }
    ],
    "version": "1.0.0",
    "type": "package",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "tymon/jwt-auth": "0.5.*",
        "dimsav/laravel-translatable": "^6.0",
        "doctrine/dbal": "^2.5",
        "felixkiss/uniquewith-validator": "2.*",
        "owen-it/laravel-auditing": "^3.1",
        "venturecraft/revisionable": "1.*",
        "yadakhov/insert-on-duplicate-key": "^1.1"
    },
    "autoload": {
        "psr-4": {
            "XXX\\YYY\\" : "/src"
        }
    }
}

Now, when i install my

xxxx/yyyy

package, I need that composer install all required packages:

"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.3.*",
    "tymon/jwt-auth": "0.5.*",
    "dimsav/laravel-translatable": "^6.0",
    "doctrine/dbal": "^2.5",
    "felixkiss/uniquewith-validator": "2.*",
    "owen-it/laravel-auditing": "^3.1",
    "venturecraft/revisionable": "1.*",
    "yadakhov/insert-on-duplicate-key": "^1.1"
},

but it dont install it.

I try composer update, composer install. Can someone help?

Project Composer.json looks like

{    
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",       
        "xxxx/yyyy" : "1.0.0"    
    },    
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "xxxx/yyyy",
                "version": "1.0.0",
                "source": {
                    "url": "example.com",
                    "type": "git",
                    "reference": "master"
                },
                "autoload": {
                    "psr-4" : {
                       "XXX\\YYY\\" : "/src"
                    }
                }
            }
       }
    ] 
}

What I can do, that Composer automatically install all package required dependencies???? Thanks for advice.

Upvotes: 1

Views: 2523

Answers (1)

Sven
Sven

Reputation: 70863

Don't use the package repository type. When you use this, you have to copy all information that usually resides inside the composer.json file of the software you are referencing.

package repositories are for scenarios where you are unable to add a composer.json file to the origin of the software. You have full control over your package, so this does not apply.

Just add a repository link of type vcs with the URL to the repository, and Composer will figure out the rest by looking at the composer.json file inside the repository. It will detect the dependencies and install them.

Upvotes: 1

Related Questions