@@ -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 **Create blank project **, fill in
36
+ the **Project name **, select the **Private ** radio button, and click the
37
+ **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,55 @@ 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 `` with your own details.
188
+
149
189
Store Your Recipes in the Private Repository
150
190
--------------------------------------------
151
191
152
192
Upload 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.
154
194
155
195
Grant ``composer `` Access to the Private Repository
156
196
---------------------------------------------------
157
197
198
+ GitHub
199
+ ~~~~~~
200
+
158
201
In your GitHub account, click your account icon in the top-right corner, select
159
202
``Settings `` and ``Developer Settings ``. Then select ``Personal Access Tokens ``.
160
203
@@ -168,9 +211,29 @@ computer, and execute the following command:
168
211
169
212
Replace ``[token] `` with the value of your GitHub personal access token.
170
213
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
+
171
231
Configure Your Project's ``composer.json `` File
172
232
-----------------------------------------------
173
233
234
+ GitHub
235
+ ~~~~~~
236
+
174
237
Add the following to your project's ``composer.json `` file:
175
238
176
239
.. code-block :: json
@@ -199,6 +262,32 @@ Replace ``your-github-account-name`` and ``your-recipes-repository`` with your o
199
262
The ``endpoint `` URL **must ** point to ``https://api.github.com/repos `` and
200
263
**not ** to ``https://www.github.com ``.
201
264
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
+
202
291
Install the Recipes in Your Project
203
292
-----------------------------------
204
293
0 commit comments