@@ -8,22 +8,34 @@ private Symfony Flex recipe repositories, and seamlessly integrate them into the
88This is particularly useful when you have private bundles or packages that must
99perform their own installation tasks. To do this, you need to complete several steps:
1010
11- * Create a private GitHub repository;
11+ * Create a private repository;
1212* Create your private recipes;
1313* Create an index to the recipes;
1414* Store your recipes in the private repository;
1515* Grant ``composer `` access to the private repository;
1616* Configure your project's ``composer.json `` file; and
1717* Install the recipes in your project.
1818
19- Create a Private GitHub Repository
20- ----------------------------------
19+ .. _create-a-private-github-repository
20+
21+ Create a Private Repository
22+ ---------------------------
23+
24+ GitHub
25+ ~~~~~~
2126
2227Log in to your GitHub.com account, click your account icon in the top-right
2328corner, and select **Your Repositories **. Then click the **New ** button, fill in
2429the **repository name **, select the **Private ** radio button, and click the
2530**Create Repository ** button.
2631
32+ Gitlab
33+ ~~~~~~
34+
35+ Log in to your Gitlab.com account, click the **New project ** button, select **Create blank project **, fill in
36+ the **Project name **, select the **Private ** radio button, and click the
37+ **Create project ** button.
38+
2739Create Your Private Recipes
2840---------------------------
2941
@@ -124,6 +136,9 @@ Create an Index to the Recipes
124136The next step is to create an ``index.json `` file, which will contain entries
125137for all your private recipes, and other general configuration information.
126138
139+ GitHub
140+ ~~~~~~
141+
127142The ``index.json `` file has the following format:
128143
129144.. code-block :: json
@@ -134,27 +149,55 @@ The ``index.json`` file has the following format:
134149 " 1.0"
135150 ]
136151 },
137- "branch" : " master " ,
152+ "branch" : " main " ,
138153 "is_contrib" : true ,
139154 "_links" : {
140155 "repository" : " github.com/your-github-account-name/your-recipes-repository" ,
141- "origin_template" : " {package}:{version}@github.com/your-github-account-name/your-recipes-repository:master " ,
156+ "origin_template" : " {package}:{version}@github.com/your-github-account-name/your-recipes-repository:main " ,
142157 "recipe_template" : " https://api.github.com/repos/your-github-account-name/your-recipes-repository/contents/{package_dotted}.{version}.json"
143158 }
144159 }
145160
146161 Create an entry in ``"recipes" `` for each of your bundle recipes. Replace
147162``your-github-account-name `` and ``your-recipes-repository `` with your own details.
148163
164+ Gitlab
165+ ~~~~~~
166+
167+ The ``index.json `` file has the following format:
168+
169+ .. code-block :: json
170+
171+ {
172+ "recipes" : {
173+ "acme/private-bundle" : [
174+ " 1.0"
175+ ]
176+ },
177+ "branch" : " main" ,
178+ "is_contrib" : true ,
179+ "_links" : {
180+ "repository" : " gitlab.com/your-gitlab-account-name/your-recipes-repository" ,
181+ "origin_template" : " {package}:{version}@gitlab.com/your-gitlab-account-name/your-recipes-repository:main" ,
182+ "recipe_template" : " https://gitlab.com/api/v4/projects/your-gitlab-project-id/repository/files/{package_dotted}.{version}.json/raw?ref=main"
183+ }
184+ }
185+
186+ Create an entry in ``"recipes" `` for each of your bundle recipes. Replace
187+ ``your-gitlab-account-name ``, ``your-gitlab-repository `` and ``your-gitlab-project-id `` with your own details.
188+
149189Store Your Recipes in the Private Repository
150190--------------------------------------------
151191
152192Upload the recipe ``.json `` file(s) and the ``index.json `` file into the root
153- directory of your private GitHub repository.
193+ directory of your private repository.
154194
155195Grant ``composer `` Access to the Private Repository
156196---------------------------------------------------
157197
198+ GitHub
199+ ~~~~~~
200+
158201In your GitHub account, click your account icon in the top-right corner, select
159202``Settings `` and ``Developer Settings ``. Then select ``Personal Access Tokens ``.
160203
@@ -168,9 +211,29 @@ computer, and execute the following command:
168211
169212 Replace ``[token] `` with the value of your GitHub personal access token.
170213
214+ Gitlab
215+ ~~~~~~
216+
217+ In your Gitlab account, click your account icon in the top-right corner, select
218+ ``Preferences `` and ``Access Tokens ``.
219+
220+ Generate a new personal access token with ``read_api `` and ``read_repository ``
221+ scopes. Copy the access token value, switch to the terminal of your local
222+ computer, and execute the following command:
223+
224+ .. code-block :: terminal
225+
226+ $ composer config --global --auth gitlab-oauth.gitlab.com [token]
227+
228+ Replace ``[token] `` with the value of your Gitlab personal access token.
229+
230+
171231Configure Your Project's ``composer.json `` File
172232-----------------------------------------------
173233
234+ GitHub
235+ ~~~~~~
236+
174237Add the following to your project's ``composer.json `` file:
175238
176239.. code-block :: json
@@ -199,6 +262,32 @@ Replace ``your-github-account-name`` and ``your-recipes-repository`` with your o
199262 The ``endpoint `` URL **must ** point to ``https://api.github.com/repos `` and
200263 **not ** to ``https://www.github.com ``.
201264
265+ Gitlab
266+ ~~~~~~
267+
268+ Add the following to your project's ``composer.json `` file:
269+
270+ .. code-block :: json
271+
272+ {
273+ "extra" : {
274+ "symfony" : {
275+ "endpoint" : [
276+ " https://gitlab.com/api/v4/projects/your-gitlab-project-id/repository/files/index.json/raw?ref=main" ,
277+ " flex://defaults"
278+ ]
279+ }
280+ }
281+ }
282+
283+ Replace ``your-gitlab-project-id `` with your own details.
284+
285+ .. tip ::
286+
287+ The ``extra.symfony `` key will most probably already exist in your
288+ ``composer.json ``. In that case, add the ``"endpoint" `` key to the existing
289+ ``extra.symfony `` entry.
290+
202291Install the Recipes in Your Project
203292-----------------------------------
204293
0 commit comments