@@ -62,16 +62,20 @@ There are two installation methods.
62
62
63
63
The advantage of using this command is that it runs through the whole installation process. Run the following command:
64
64
65
- composer create-project dotkernel/admin -s dev dk
65
+ ``` shell
66
+ composer create-project dotkernel/admin -s dev dk
67
+ ```
66
68
67
69
The above command downloads the ` admin ` package, then downloads and installs the ` dependencies ` .
68
70
69
71
The setup script prompts for some configuration settings, for example the lines below:
70
72
71
- Please select which config file you wish to inject 'Laminas\Diactoros\ConfigProvider' into:
73
+ ``` text
74
+ Please select which config file you wish to inject 'Laminas\Diactoros\ConfigProvider' into:
72
75
[0] Do not inject
73
76
[1] config/config.php
74
77
Make your selection (default is 1):
78
+ ```
75
79
76
80
Simply select ` [0] Do not inject ` , because Dotkernel includes its own configProvider which already contains the prompted
77
81
configurations.
@@ -89,11 +93,15 @@ Type `y` here, and hit `enter`
89
93
This method requires more manual input, but it ensures that the default branch is installed, even if it is not released.
90
94
Run the following command:
91
95
92
- git clone https://github.com/dotkernel/admin.git .
96
+ ``` shell
97
+ git clone https://github.com/dotkernel/admin.git .
98
+ ```
93
99
94
100
The dependencies have to be installed separately, by running this command
95
101
96
- composer install
102
+ ``` shell
103
+ composer install
104
+ ```
97
105
98
106
Just like for ` II Installing Dotkernel admin using composer ` (see above), the setup asks for configuration settings
99
107
regarding injections (type ` 0 ` and hit ` enter ` ) and a confirmation to use this setting for other packages (type ` y ` and
@@ -106,18 +114,33 @@ hit `enter`)
106
114
107
115
Run the migrations and seeds with these commands:
108
116
109
- php bin/doctrine-migrations migrate
110
-
111
- php bin/doctrine fixtures:execute
117
+ ``` shell
118
+ php bin/doctrine-migrations migrate
119
+ ```
120
+ ``` shell
121
+ php bin/doctrine fixtures:execute
122
+ ```
112
123
113
124
- If you use ` composer create-project ` , the project will go into development mode automatically after installing. The
114
125
development mode status can be checked and toggled by using these composer commands:
115
126
116
- composer development-status
127
+ You can check if you have development mode enabled by running:
128
+
129
+ ``` shell
130
+ composer development-status
131
+ ```
132
+
133
+ You can enable development mode by running:
117
134
118
- composer development-enable
135
+ ``` shell
136
+ composer development-enable
137
+ ```
119
138
120
- composer development-disable
139
+ You can disable development mode by running:
140
+
141
+ ``` shell
142
+ composer development-disable
143
+ ```
121
144
122
145
- If not already done on installation, remove the ` .dist ` extension from ` config/autoload/development.global.php.dist ` .
123
146
This will enable dev mode by turning debug flag to ` true ` and turning configuration caching to ` off ` . It will also
@@ -129,13 +152,17 @@ Run the migrations and seeds with these commands:
129
152
130
153
You can download/update a specific GeoLite2 database, by running the following command:
131
154
132
- php bin/cli.php geoip:synchronize -d {DATABASE}
155
+ ``` shell
156
+ php bin/cli.php geoip:synchronize -d {DATABASE}
157
+ ```
133
158
134
159
Where _ {DATABASE}_ takes one of the following values: ` asn ` , ` city ` , ` country ` .
135
160
136
161
You can download/update all GeoLite2 databases at once, by running the following command:
137
162
138
- php bin/cli.php geoip:synchronize
163
+ ``` shell
164
+ php bin/cli.php geoip:synchronize
165
+ ```
139
166
140
167
The output should be similar to the below, displaying per
141
168
row: ` database identifier ` : ` previous build datetime ` -> ` current build datetime ` .
@@ -148,7 +175,9 @@ row: `database identifier`: `previous build datetime` -> `current build datetime
148
175
149
176
Get help for this command by running:
150
177
151
- php bin/cli.php help geoip:synchronize
178
+ ``` shell
179
+ php bin/cli.php help geoip:synchronize
180
+ ```
152
181
153
182
** Tip** : If you setup the synchronizer command as a cronjob, you can add the ` -q|--quiet ` option, and it will output
154
183
data only if an error has occurred.
@@ -157,18 +186,24 @@ data only if an error has occurred.
157
186
158
187
To install dependencies into the ` node_modules ` directory run this command.
159
188
160
- npm install
189
+ ``` shell
190
+ npm install
191
+ ```
161
192
162
193
If ` npm install ` fails, this could be caused by user permissions of npm. Recommendation is to install npm
163
194
through ` Node Version Manager ` .
164
195
165
196
The watch command compiles the components then watches the files and recompiles when one of them changes.
166
197
167
- npm run watch
198
+ ``` shell
199
+ npm run watch
200
+ ```
168
201
169
202
After all updates are done, this command compiles the assets locally, minifies them and makes them ready for production.
170
203
171
- npm run prod
204
+ ``` shell
205
+ npm run prod
206
+ ```
172
207
173
208
## Authorization Guards
174
209
@@ -180,57 +215,63 @@ the platform by specifying the type of role the user has.
180
215
The ` authorization.global.php ` file provides multiple configurations specifying multiple roles as well as the types of
181
216
permissions to which these roles have access.
182
217
183
- 'roles' => [
184
- 'superuser' => [
185
- 'permissions' => [
186
- 'authenticated',
187
- 'edit',
188
- 'delete',
189
- //etc..
190
- ]
191
- ],
192
- 'admin' => [
193
- 'permissions' => [
194
- 'authenticated',
195
- //etc..
196
- ]
197
- ]
198
- ]
218
+ ``` text
219
+ 'roles' => [
220
+ 'superuser' => [
221
+ 'permissions' => [
222
+ 'authenticated',
223
+ 'edit',
224
+ 'delete',
225
+ //etc..
226
+ ]
227
+ ],
228
+ 'admin' => [
229
+ 'permissions' => [
230
+ 'authenticated',
231
+ //etc..
232
+ ]
233
+ ]
234
+ ]
235
+ ```
199
236
200
237
The ` authorization-guards.global.php ` file provides configuration to restrict access to certain actions based on the
201
238
permissions defined in ` authorization.global.php ` so basically we have to add the permissions in the dot-rbac
202
239
configuration file first to specify the action restriction permissions.
203
240
204
- 'rules' => [
205
- [
206
- 'route' => 'account',
207
- 'actions ' => [//list of actions to apply , or empty array for all actions
208
- 'unregister',
209
- 'avatar ',
210
- 'details ',
211
- 'changePassword'
212
- ],
213
- 'permissions' => ['authenticated']
214
- ],
215
- [
216
- 'route' => 'admin',
217
- 'actions ' => [
218
- 'deleteAccount'
219
- ],
220
- 'permissions' => [
221
- 'delete'
222
- //list of roles to allow
223
- ]
224
- ]
241
+ ``` text
242
+ 'rules' => [
243
+ [
244
+ 'route ' => 'account',
245
+ 'actions' => [//list of actions to apply , or empty array for all actions
246
+ 'unregister ',
247
+ 'avatar ',
248
+ 'details',
249
+ 'changePassword'
250
+ ],
251
+ 'permissions' => ['authenticated']
252
+ ],
253
+ [
254
+ 'route ' => 'admin',
255
+ 'actions' => [
256
+ 'deleteAccount'
257
+ ],
258
+ 'permissions' => [
259
+ 'delete'
260
+ //list of roles to allow
261
+ ]
225
262
]
263
+ ]
264
+ ```
226
265
227
266
## Testing (Running)
228
267
229
268
Note: ** Do not enable dev mode in production**
230
269
231
270
- Run the following command in your project's directory to start PHPs built-in server:
232
271
233
- php -S 0.0.0.0:8080 -t public
272
+ ``` shell
273
+ php -S 0.0.0.0:8080 -t public
274
+ ```
234
275
235
276
> Running command ` composer serve ` will do the exact same, but the above is faster.
236
277
@@ -241,7 +282,9 @@ Note: **Do not enable dev mode in production**
241
282
** NOTE:**
242
283
If you are still getting exceptions or errors regarding some missing services, try running the following command
243
284
244
- php bin/clear-config-cache.php
285
+ ``` shell
286
+ php bin/clear-config-cache.php
287
+ ```
245
288
246
289
> If ` config-cache.php ` is present that config will be loaded regardless of the ` ConfigAggregator::ENABLE_CACHE `
247
290
> in ` config/autoload/mezzio.global.php `
@@ -260,10 +303,12 @@ If you ran the migrations you will have an admin user in the database with the f
260
303
- ** Production only** : Make sure you modify the default admin credentials.
261
304
- ** Development only** : ` session.cookie_secure ` does not work locally so make sure you modify your ` local.php ` , as per the following:
262
305
263
- return [
264
- 'session_config' => [
265
- 'cookie_secure' => false,
266
- ]
267
- ];
306
+ ``` text
307
+ return [
308
+ 'session_config' => [
309
+ 'cookie_secure' => false,
310
+ ]
311
+ ];
312
+ ```
268
313
269
314
Do not change this in ` local.php.dist ` as well because this value should remain ` true ` on production.
0 commit comments