|
| 1 | +Contribute to yii2-fractal library |
| 2 | +================================== |
| 3 | + |
| 4 | +### Local setup |
| 5 | + |
| 6 | +[Docker](https://docs.docker.com/engine/install/) is required |
| 7 | + |
| 8 | +```bash |
| 9 | +git clone git@github.com:php-openapi/yii2-fractal.git |
| 10 | +cd yii2-fractal |
| 11 | +make up |
| 12 | +make installdocker # only once during initiation |
| 13 | +``` |
| 14 | + |
| 15 | +### Test |
| 16 | + |
| 17 | +Ensure you followed steps mentioned in Local setup, then |
| 18 | + |
| 19 | +```bash |
| 20 | +make cli |
| 21 | +make test |
| 22 | +``` |
| 23 | + |
| 24 | +### Switching PHP versions |
| 25 | + |
| 26 | + |
| 27 | +You can switch the PHP version of the docker runtime by changing the `PHP_VERSION` environment variable in the `.env` file. |
| 28 | + |
| 29 | +If you have no `.env` file yet, create it by copying `.env.dist` to `.env`. |
| 30 | + |
| 31 | +After changing the PHP Version you need to run `make clean_all up` to start the new container with new version. |
| 32 | + |
| 33 | +Example: |
| 34 | + |
| 35 | +``` |
| 36 | +$ echo "PHP_VERSION=7.4" > .env |
| 37 | +$ make clean_all up cli |
| 38 | +Stopping yii2-openapi_php_1 ... done # TODO |
| 39 | +Stopping yii2-openapi_maria_1 ... done |
| 40 | +Stopping yii2-openapi_postgres_1 ... done |
| 41 | +Stopping yii2-openapi_mysql_1 ... done |
| 42 | +Removing yii2-openapi_php_1 ... done |
| 43 | +Removing yii2-openapi_maria_1 ... done |
| 44 | +Removing yii2-openapi_postgres_1 ... done |
| 45 | +Removing yii2-openapi_mysql_1 ... done |
| 46 | +Removing network yii2-openapi_default |
| 47 | +Creating network "yii2-openapi_default" with driver "bridge" |
| 48 | +Creating yii2-openapi_maria_1 ... done |
| 49 | +Creating yii2-openapi_mysql_1 ... done |
| 50 | +Creating yii2-openapi_postgres_1 ... done |
| 51 | +Creating yii2-openapi_php_1 ... done |
| 52 | +docker-compose exec php bash |
| 53 | +
|
| 54 | +root@f9928598f841:/app# php -v |
| 55 | +
|
| 56 | +PHP 7.4.27 (cli) (built: Jan 26 2022 18:08:44) ( NTS ) |
| 57 | +Copyright (c) The PHP Group |
| 58 | +Zend Engine v3.4.0, Copyright (c) Zend Technologies |
| 59 | +with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies |
| 60 | +with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans |
| 61 | +``` |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + ### Testing # todo remove |
| 67 | + |
| 68 | + - Clone project |
| 69 | + - Run `make up` |
| 70 | + - Run once `make installdocker` |
| 71 | + - Run `make testdocker` or `make cli` and inside docker env `make test` |
0 commit comments