@@ -8,22 +8,34 @@ private Symfony Flex recipe repositories, and seamlessly integrate them into the
8
8
This is particularly useful when you have private bundles or packages that must
9
9
perform their own installation tasks. To do this, you need to complete several steps:
10
10
11
- * Create a private GitHub repository;
11
+ * Create a private repository;
12
12
* Create your private recipes;
13
13
* Create an index to the recipes;
14
14
* Store your recipes in the private repository;
15
15
* Grant ``composer `` access to the private repository;
16
16
* Configure your project's ``composer.json `` file; and
17
17
* Install the recipes in your project.
18
18
19
- Create a Private GitHub Repository
20
- ----------------------------------
19
+ .. _create-a-private-github-repository
20
+
21
+ Create a Private Repository
22
+ ---------------------------
23
+
24
+ GitHub
25
+ ~~~~~~
21
26
22
27
Log in to your GitHub.com account, click your account icon in the top-right
23
28
corner, and select **Your Repositories **. Then click the **New ** button, fill in
24
29
the **repository name **, select the **Private ** radio button, and click the
25
30
**Create Repository ** button.
26
31
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
+
27
39
Create Your Private Recipes
28
40
---------------------------
29
41
@@ -124,6 +136,9 @@ Create an Index to the Recipes
124
136
The next step is to create an ``index.json `` file, which will contain entries
125
137
for all your private recipes, and other general configuration information.
126
138
139
+ GitHub
140
+ ~~~~~~
141
+
127
142
The ``index.json `` file has the following format:
128
143
129
144
.. code-block :: json
@@ -134,27 +149,56 @@ The ``index.json`` file has the following format:
134
149
" 1.0"
135
150
]
136
151
},
137
- "branch" : " master " ,
152
+ "branch" : " main " ,
138
153
"is_contrib" : true ,
139
154
"_links" : {
140
155
"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 " ,
142
157
"recipe_template" : " https://api.github.com/repos/your-github-account-name/your-recipes-repository/contents/{package_dotted}.{version}.json"
143
158
}
144
159
}
145
160
146
161
Create an entry in ``"recipes" `` for each of your bundle recipes. Replace
147
162
``your-github-account-name `` and ``your-recipes-repository `` with your own details.
148
163
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
+
149
190
Store Your Recipes in the Private Repository
150
191
--------------------------------------------
151
192
152
193
Upload 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.
154
195
155
196
Grant ``composer `` Access to the Private Repository
156
197
---------------------------------------------------
157
198
199
+ GitHub
200
+ ~~~~~~
201
+
158
202
In your GitHub account, click your account icon in the top-right corner, select
159
203
``Settings `` and ``Developer Settings ``. Then select ``Personal Access Tokens ``.
160
204
@@ -168,9 +212,29 @@ computer, and execute the following command:
168
212
169
213
Replace ``[token] `` with the value of your GitHub personal access token.
170
214
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
+
171
232
Configure Your Project's ``composer.json `` File
172
233
-----------------------------------------------
173
234
235
+ GitHub
236
+ ~~~~~~
237
+
174
238
Add the following to your project's ``composer.json `` file:
175
239
176
240
.. code-block :: json
@@ -199,6 +263,32 @@ Replace ``your-github-account-name`` and ``your-recipes-repository`` with your o
199
263
The ``endpoint `` URL **must ** point to ``https://api.github.com/repos `` and
200
264
**not ** to ``https://www.github.com ``.
201
265
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
+
202
292
Install the Recipes in Your Project
203
293
-----------------------------------
204
294
0 commit comments