Yes, all you need to do is list your fork as a repository to use and Composer will automatically include the fork in preference to the original package. From the documentation
If you are using a certain library for your project and you decide to change something in the library, you will want your project to use the patched version. If the library is on GitHub (this is the case most of the time), you can simply fork it there and push your changes to your fork. After that you update the project's composer.json. All you have to do is add your fork as a repository and update the version constraint to point to your custom branch.
An example where someone has patched Monolog. They then tell Composer to use their repository.
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/igorw/monolog"
}
],
"require": {
"monolog/monolog": "dev-bugfix"
}
}
Composer will scan all the versions available in https://github.com/igorw/monolog
and use them in preference to the version of Monolog available on Packagist.
You can also tell Composer to use local directories rather than an HTTP address.
"repositories": [
{
"type": "vcs",
"url": "/documents/project/igorw/monolog"
}
],
This allows you to develop library, use it in another project and test it without having to push to Github between each edit and test.