@@ -62,16 +62,20 @@ There are two installation methods.
6262
6363The advantage of using this command is that it runs through the whole installation process. Run the following command:
6464
65- composer create-project dotkernel/admin -s dev dk
65+ ``` shell
66+ composer create-project dotkernel/admin -s dev dk
67+ ```
6668
6769The above command downloads the ` admin ` package, then downloads and installs the ` dependencies ` .
6870
6971The setup script prompts for some configuration settings, for example the lines below:
7072
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:
7275 [0] Do not inject
7376 [1] config/config.php
7477 Make your selection (default is 1):
78+ ```
7579
7680Simply select ` [0] Do not inject ` , because Dotkernel includes its own configProvider which already contains the prompted
7781configurations.
@@ -89,11 +93,15 @@ Type `y` here, and hit `enter`
8993This method requires more manual input, but it ensures that the default branch is installed, even if it is not released.
9094Run the following command:
9195
92- git clone https://github.com/dotkernel/admin.git .
96+ ``` shell
97+ git clone https://github.com/dotkernel/admin.git .
98+ ```
9399
94100The dependencies have to be installed separately, by running this command
95101
96- composer install
102+ ``` shell
103+ composer install
104+ ```
97105
98106Just like for ` II Installing Dotkernel admin using composer ` (see above), the setup asks for configuration settings
99107regarding 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`)
106114
107115Run the migrations and seeds with these commands:
108116
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+ ```
112123
113124- If you use ` composer create-project ` , the project will go into development mode automatically after installing. The
114125 development mode status can be checked and toggled by using these composer commands:
115126
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:
117134
118- composer development-enable
135+ ``` shell
136+ composer development-enable
137+ ```
119138
120- composer development-disable
139+ You can disable development mode by running:
140+
141+ ``` shell
142+ composer development-disable
143+ ```
121144
122145- If not already done on installation, remove the ` .dist ` extension from ` config/autoload/development.global.php.dist ` .
123146 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:
129152
130153You can download/update a specific GeoLite2 database, by running the following command:
131154
132- php bin/cli.php geoip:synchronize -d {DATABASE}
155+ ``` shell
156+ php bin/cli.php geoip:synchronize -d {DATABASE}
157+ ```
133158
134159Where _ {DATABASE}_ takes one of the following values: ` asn ` , ` city ` , ` country ` .
135160
136161You can download/update all GeoLite2 databases at once, by running the following command:
137162
138- php bin/cli.php geoip:synchronize
163+ ``` shell
164+ php bin/cli.php geoip:synchronize
165+ ```
139166
140167The output should be similar to the below, displaying per
141168row: ` database identifier ` : ` previous build datetime ` -> ` current build datetime ` .
@@ -148,7 +175,9 @@ row: `database identifier`: `previous build datetime` -> `current build datetime
148175
149176Get help for this command by running:
150177
151- php bin/cli.php help geoip:synchronize
178+ ``` shell
179+ php bin/cli.php help geoip:synchronize
180+ ```
152181
153182** Tip** : If you setup the synchronizer command as a cronjob, you can add the ` -q|--quiet ` option, and it will output
154183data only if an error has occurred.
@@ -157,18 +186,24 @@ data only if an error has occurred.
157186
158187To install dependencies into the ` node_modules ` directory run this command.
159188
160- npm install
189+ ``` shell
190+ npm install
191+ ```
161192
162193If ` npm install ` fails, this could be caused by user permissions of npm. Recommendation is to install npm
163194through ` Node Version Manager ` .
164195
165196The watch command compiles the components then watches the files and recompiles when one of them changes.
166197
167- npm run watch
198+ ``` shell
199+ npm run watch
200+ ```
168201
169202After all updates are done, this command compiles the assets locally, minifies them and makes them ready for production.
170203
171- npm run prod
204+ ``` shell
205+ npm run prod
206+ ```
172207
173208## Authorization Guards
174209
@@ -180,57 +215,63 @@ the platform by specifying the type of role the user has.
180215The ` authorization.global.php ` file provides multiple configurations specifying multiple roles as well as the types of
181216permissions to which these roles have access.
182217
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+ ```
199236
200237The ` authorization-guards.global.php ` file provides configuration to restrict access to certain actions based on the
201238permissions defined in ` authorization.global.php ` so basically we have to add the permissions in the dot-rbac
202239configuration file first to specify the action restriction permissions.
203240
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+ ]
225262 ]
263+ ]
264+ ```
226265
227266## Testing (Running)
228267
229268Note: ** Do not enable dev mode in production**
230269
231270- Run the following command in your project's directory to start PHPs built-in server:
232271
233- php -S 0.0.0.0:8080 -t public
272+ ``` shell
273+ php -S 0.0.0.0:8080 -t public
274+ ```
234275
235276> Running command ` composer serve ` will do the exact same, but the above is faster.
236277
@@ -241,7 +282,9 @@ Note: **Do not enable dev mode in production**
241282** NOTE:**
242283If you are still getting exceptions or errors regarding some missing services, try running the following command
243284
244- php bin/clear-config-cache.php
285+ ``` shell
286+ php bin/clear-config-cache.php
287+ ```
245288
246289> If ` config-cache.php ` is present that config will be loaded regardless of the ` ConfigAggregator::ENABLE_CACHE `
247290> 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
260303- ** Production only** : Make sure you modify the default admin credentials.
261304- ** Development only** : ` session.cookie_secure ` does not work locally so make sure you modify your ` local.php ` , as per the following:
262305
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+ ```
268313
269314Do not change this in ` local.php.dist ` as well because this value should remain ` true ` on production.
0 commit comments