Productive Environment for PHP Teams - II
Previous post shown the reasons to host a local Composer repository. This will show the code to accomplish that point.
Let’s get dirty!
Setting up a local Composer respository
Install Composer
If you didn’t previously:
1 2 |
|
Install Satis
1 2 |
|
At this point you can generate a package.json
through Satis in order to use a local repository.
To generate a Composer-repo from a Git-repo the only requirement is to have a valid composer.json
on the root folder at master branch.
Add a composer.json file to your Git repo
Composer helps you to do this:
1
|
|
Generate a Composer-repo from your Git-repo
All you need is to edit a satis.json
file
1 2 3 4 5 6 7 8 9 10 11 12 |
|
And generate the Composer repo:
1
|
|
And you are done!!!
Install from your Composer repository
Edit your composer.json
, add your require package name and the local repo, which you can publish through http in order to be accesed locally:
1 2 3 4 |
|
You can avoid coping the repositories line by adding the repository to the default reposiitories:
1 2 3 4 5 6 7 8 |
|
Improving the environment
This is quite complex just to get a private Composer repo, so next post in this serie will cover how to automate this tasks, and get a local GitHub working.