Local development workflow for composer packages

My situation is that I’m working on one project (p1) and find that a class that I’ve started writing is useable in other projects so I create a new composer project/package for just that class/file (c1). I add c1 to github and tell p1 to get it from there. Now I would like to keep working on c1 and p1 simultaneously without having to commit/push every change of c1 to github and run composer update on p1. Something like npm link, https://www.npmjs.org/doc/cli/npm-link.html

An alternative is to keep the class in p1 untill I find it works as I like and then move it into its own package but I would like it even more if I could use something linke npm link.

Tell me if I should try to explain it more clearly.

While working on c1, you could remove the files composer installed from your vendor/ directory and create a symlink to your working directory for c1. Then when c1 is done, remove the symlink, and run composer update so the files get pulled in from composer again.

Thanks, I’ll try that. I also found https://github.com/composer/composer/issues/2290

git repositories can be nested in the file system.

p1 - Hooked to p1 repository
  vendor
    c1 - Hooked to c1 repository

As you make changes to c1, p1 will see them without doing anything. You would then commit p1 and c1 individually. Works reasonably well for me.

You can go one step further and have p1/composer.json automatically fetch the c1 repository when you do a composer install. So p1 can be dependent on one version of c1 and p2 can be dependent on a different version.

Will look into this too and see what I choose to do, thanks!

you can define custom package sources, it could be either a github repository or something on your local file system

"repositories": [
{
    "type": "vcs",
    "url": "https://github.com/..."
},
{
    "type":"vcs",
    "url": "../otherfolder/.git/"
}
],