Private Composer Repo with GitLab and Satis ########################################### :category: PHP :tags: composer, satis, gitlab :date: 2018-03-09 16:44 +02:00 :updated: 2019-02-19 14:06 +02:00 You can easily create your own composer repository using Satis and GitLab. I will use global ``_ but it should be most useful for private corporate GitLab installations. You will need CI and Pages .. TEASER_END Our repo should contain only 2 files: :code:`satis.json` and :code:`.gitlab-ci.yml` satis.json ========== :code:`satis.json` should describe the repo you want. It is very close by structure to :code:`composer.json`. Refer to `Satis documentation`_ for advanced use cases, I will go with the simplest one: add some packages from GitLab and require all of them .. _Satis documentation: https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md .. listing:: php/satis-gitlab/satis.json json .gitlab-ci.yml ============== Now the tricky part that took me quite some time to debug, but you probably can just copy-paste my solution. You need to set a private variable :code:`COMPOSER_AUTH` which should contain the content of your :code:`auth.json` like GitHub OAuth Token or access data for your private GitLab instance. (Set it to :code:`{}` if you need none of it) .. note:: Jan 19, 2019: code has been updated to create auth.json in base path not in composer path .. note:: Feb 19, 2019: code has been updated to not create auth.json at all and use only env variable. Also :code:`AUTH_JSON` was renamed to :code:`COMPOSER_AUTH` to be in line with the composer config env .. listing:: php/satis-gitlab/gitlab-ci.yml yaml Result ====== You can find my example repo project at ``_ and generated Satis repo at ``_