@@ -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
36+ **Create blank project **, fill in the **Project name **, select the **Private **
37+ radio button, and click the **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,56 @@ 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 ``
188+ with your own details.
189+
149190Store Your Recipes in the Private Repository
150191--------------------------------------------
151192
152193Upload the recipe ``.json `` file(s) and the ``index.json `` file into the root
153- directory of your private GitHub repository.
194+ directory of your private repository.
154195
155196Grant ``composer `` Access to the Private Repository
156197---------------------------------------------------
157198
199+ GitHub
200+ ~~~~~~
201+
158202In your GitHub account, click your account icon in the top-right corner, select
159203``Settings `` and ``Developer Settings ``. Then select ``Personal Access Tokens ``.
160204
@@ -168,9 +212,29 @@ computer, and execute the following command:
168212
169213 Replace ``[token] `` with the value of your GitHub personal access token.
170214
215+ Gitlab
216+ ~~~~~~
217+
218+ In your Gitlab account, click your account icon in the top-right corner, select
219+ ``Preferences `` and ``Access Tokens ``.
220+
221+ Generate a new personal access token with ``read_api `` and ``read_repository ``
222+ scopes. Copy the access token value, switch to the terminal of your local
223+ computer, and execute the following command:
224+
225+ .. code-block :: terminal
226+
227+ $ composer config --global --auth gitlab-oauth.gitlab.com [token]
228+
229+ Replace ``[token] `` with the value of your Gitlab personal access token.
230+
231+
171232Configure Your Project's ``composer.json `` File
172233-----------------------------------------------
173234
235+ GitHub
236+ ~~~~~~
237+
174238Add the following to your project's ``composer.json `` file:
175239
176240.. code-block :: json
@@ -199,6 +263,32 @@ Replace ``your-github-account-name`` and ``your-recipes-repository`` with your o
199263 The ``endpoint `` URL **must ** point to ``https://api.github.com/repos `` and
200264 **not ** to ``https://www.github.com ``.
201265
266+ Gitlab
267+ ~~~~~~
268+
269+ Add the following to your project's ``composer.json `` file:
270+
271+ .. code-block :: json
272+
273+ {
274+ "extra" : {
275+ "symfony" : {
276+ "endpoint" : [
277+ " https://gitlab.com/api/v4/projects/your-gitlab-project-id/repository/files/index.json/raw?ref=main" ,
278+ " flex://defaults"
279+ ]
280+ }
281+ }
282+ }
283+
284+ Replace ``your-gitlab-project-id `` with your own details.
285+
286+ .. tip ::
287+
288+ The ``extra.symfony `` key will most probably already exist in your
289+ ``composer.json ``. In that case, add the ``"endpoint" `` key to the existing
290+ ``extra.symfony `` entry.
291+
202292Install the Recipes in Your Project
203293-----------------------------------
204294
0 commit comments