@@ -12,19 +12,19 @@ Docker running Nginx, PHP-FPM, Composer, MySQL and PHPMyAdmin.
12
12
13
13
We’ll download the code from its repository on GitHub.
14
14
15
- 3 . [ Configure Nginx With SSL Certificates] ( #configure-nginx-with-ssl-certificates ) [ Optional]
15
+ 3 . [ Configure Nginx With SSL Certificates] ( #configure-nginx-with-ssl-certificates ) [ ` Optional ` ]
16
16
17
17
We'll generate and configure SSL certificate for nginx before running server.
18
18
19
- 4 . [ Configure Xdebug] ( #configure-xdebug ) [ Optional]
19
+ 4 . [ Configure Xdebug] ( #configure-xdebug ) [ ` Optional ` ]
20
20
21
21
We'll configure Xdebug for IDE (PHPStorm or Netbeans).
22
22
23
23
5 . [ Run the application] ( #run-the-application )
24
24
25
25
By this point we’ll have all the project pieces in place.
26
26
27
- 6 . [ Use Makefile] ( #use-makefile ) [ Optional]
27
+ 6 . [ Use Makefile] ( #use-makefile ) [ ` Optional ` ]
28
28
29
29
When developing, you can use ` Makefile ` for doing recurrent operations.
30
30
@@ -225,20 +225,20 @@ ___
225
225
226
226
When developing, you can use [Makefile](https://en.wikipedia.org/wiki/Make_(software)) for doing the following operations :
227
227
228
- | Name | Description |
229
- | ---------------| --------------------------------------------|
230
- | apidoc | Generate documentation of API |
231
- | clean | Clean directories for reset |
232
- | code-sniff | Check the API with PHP Code Sniffer (PSR2) |
233
- | composer-up | Update PHP dependencies with composer |
234
- | docker-start | Create and start containers |
235
- | docker-stop | Stop and clear all services |
236
- | gen-certs | Generate SSL certificates for ` nginx` |
237
- | logs | Follow log output |
238
- | mysql-dump | Create backup of whole database |
239
- | mysql-restore | Restore backup from whole database |
240
- | phpmd | Analyse the API with PHP Mess Detector |
241
- | test | Test application with phpunit |
228
+ | Name | Description |
229
+ | ---------------| ---------------------------------------------- |
230
+ | apidoc | Generate documentation of API |
231
+ | clean | Clean directories for reset |
232
+ | code-sniff | Check the API with PHP Code Sniffer (` PSR2` ) |
233
+ | composer-up | Update PHP dependencies with composer |
234
+ | docker-start | Create and start containers |
235
+ | docker-stop | Stop and clear all services |
236
+ | gen-certs | Generate SSL certificates for ` nginx` |
237
+ | logs | Follow log output |
238
+ | mysql-dump | Create backup of all databases |
239
+ | mysql-restore | Restore backup of all databases |
240
+ | phpmd | Analyse the API with PHP Mess Detector |
241
+ | test | Test application with phpunit |
242
242
243
243
# ## Examples
244
244
@@ -273,7 +273,7 @@ sudo docker run --rm -v $(pwd)/web/app:/app composer update
273
273
# ## Generating PHP API documentation
274
274
275
275
` ` ` sh
276
- sudo docker-compose exec -T php ./app/vendor/bin/apigen generate app/src --destination ./app/doc
276
+ sudo docker-compose exec -T php php -d memory_limit=256M -d xdebug.profiler_enable=0 ./app/vendor/bin/apigen generate app/src --destination ./app/doc
277
277
` ` `
278
278
279
279
# ## Testing PHP application with PHPUnit
@@ -282,6 +282,12 @@ sudo docker-compose exec -T php ./app/vendor/bin/apigen generate app/src --desti
282
282
sudo docker-compose exec -T php ./app/vendor/bin/phpunit --colors=always --configuration ./app/
283
283
` ` `
284
284
285
+ # ## Fixing standard code with [PSR2](http://www.php-fig.org/psr/psr-2/)
286
+
287
+ ` ` ` sh
288
+ sudo docker-compose exec -T php ./app/vendor/bin/phpcs -v --standard=PSR2 ./app/src/
289
+ ` ` `
290
+
285
291
# ## Checking the standard code with [PSR2](http://www.php-fig.org/psr/psr-2/)
286
292
287
293
` ` ` sh
314
320
mysql -u" $MYSQL_ROOT_USER " -p" $MYSQL_ROOT_PASSWORD "
315
321
` ` `
316
322
317
- # ### Backup of database
323
+ # ### Creating a backup of all databases
318
324
319
325
` ` ` sh
320
326
mkdir -p data/db/dumps
@@ -324,13 +330,7 @@ mkdir -p data/db/dumps
324
330
source .env && sudo docker exec $( sudo docker-compose ps -q mysqldb) mysqldump --all-databases -u" $MYSQL_ROOT_USER " -p" $MYSQL_ROOT_PASSWORD " > " data/db/dumps/db.sql"
325
331
` ` `
326
332
327
- or
328
-
329
- ` ` ` sh
330
- source .env && sudo docker exec $( sudo docker-compose ps -q mysqldb) mysqldump test -u" $MYSQL_ROOT_USER " -p" $MYSQL_ROOT_PASSWORD " > " data/db/dumps/test.sql"
331
- ` ` `
332
-
333
- # ### Restore Database
333
+ # ### Restoring a backup of all databases
334
334
335
335
` ` ` sh
336
336
source .env && sudo docker exec -i $( sudo docker-compose ps -q mysqldb) mysql -u" $MYSQL_ROOT_USER " -p" $MYSQL_ROOT_PASSWORD " < " data/db/dumps/db.sql"
0 commit comments