Broshi
Broshi

Reputation: 3592

composer local package refuses to grab from local path

I am trying to modify an existing composer package. I forked the original package from github, cloned it on my local machine and now trying to make my laravel app use it with the following composer.json file:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "5.6.*",
        ....
        "vendor/packagenamehere": "dev-dynamic-logo",
        ....
    },
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "composer",
            "url": "https://www.setasign.com/downloads/"
        },
        {
            "type": "path",
            "url": "path/to/package/on/my/machine",
            "options": {
              "symlink": true
            }
        }
    ],
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "laravel/dusk": "^1.0",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7",
        "staudenmeir/dusk-updater": "^1.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Helpers/env.php",
             ....
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

Then im firing composer update vendor/packagename --prefer-dist - and nothing.

No matter what I try, composer still grabs from packagist.

Any ideas?

Upvotes: 0

Views: 729

Answers (1)

JulienCC
JulienCC

Reputation: 528

From https://getcomposer.org/doc/05-repositories.md#path :

If the package is a local VCS repository, the version may be inferred by the branch or tag that is currently checked out. Otherwise, the version should be explicitly defined in the package's composer.json file. If the version cannot be resolved by these means, it is assumed to be dev-master.

Make sure that the "dynamic-logo" branch is checked out in your cloned package repo or update the version in the composer.json of the package. Also check that the name of the package declared in it's composer.json matches your "vendor/packagename".

Upvotes: 1

Related Questions