0

While I am developing, there are certain dependencies that I want to have as git clones.

(Partly in case I find bugs and want to submit patches, also because when I'm trying to work things out I pepper code with debug statements, and git lets me clean them all up in one go!).

But all the packages that composer downloads are plain files.

How do I get composer to save packages as git clones? Ideally just some of them, not all of them.

1 Answer 1

4

Install all dependencies from source

Run

$ composer install --prefer-source 

to install all dependencies from source (where available).

See https://getcomposer.org/doc/03-cli.md#install:

--prefer-source: There are two ways of downloading a package: source and dist. For stable versions Composer will use the dist by default. The source is a version control repository. If --prefer-source is enabled, Composer will install from source if there is one. This is useful if you want to make a bugfix to a project and get a local git clone of the dependency directly.

Install selected dependencies from source

Alternatively, configure selected dependencies to be installed from source (or dist) under the preferred-install section in composer.json:

{
    "config": {
        "preferred-install": {
            "foo/bar": "source",
            "bar/baz": "source",
            "*": "dist"
        }
    }
}

See https://getcomposer.org/doc/06-config.md#preferred-install:

Defaults to auto and can be any of source, dist or auto. This option allows you to set the install method Composer will prefer to use. Can optionally be a hash of patterns for more granular install preferences.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.