Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active August 14, 2024 07:56
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

@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