Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active January 4, 2023 19:36
Show Gist options
  • Save ziadoz/6a4186f942062b8dbcdb to your computer and use it in GitHub Desktop.
Save ziadoz/6a4186f942062b8dbcdb to your computer and use it in GitHub Desktop.
Composer Using Local Repositories and Branches
{
"repositories": [
{
"type": "path",
"url": "../relative/project/path"
}
],
"require": {
"${project}": "dev-${branch}"
}
}
{
"repositories": [
{
"type": "vcs",
"url": "/absolute/project/path"
}
],
"require": {
"${project}": "dev-${branch}"
}
}

Notes

You can pull in a local project (e.g. for testing changes) using either vcs or path repository types in Composer:

VCS

Put the path to the local project VCS (Git, Hg, SVN etc) in the url field.

See: composer_vcs.json

Path

Put the relative path to the local project in the url field.

See: composer_path.json

Branch

Prefix the branch name you want to use with dev-, so my-branch becomes dev-my-branch.

Links

Install a Local Package with Composer

Using a Branch as a Dependency in Composer

Composer Path Repositories

@DanyelMorales
Copy link

Thanks a lot!!!, This was helpful.

@ndunks
Copy link

ndunks commented Sep 16, 2017

Great, helped a newcomers..
repositories type "path" work by creating junction instead copying whole project on windows 10

@jjsty1e
Copy link

jjsty1e commented Feb 27, 2019

thanks, helpful.

@saber13812002
Copy link

Thanks a lot!!!, This was helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment