|
| 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 [email protected]: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 | +While development, you might need to support multiple versions of PHP. You can run tests locally in a Docker container in a different PHP version. |
| 27 | + |
| 28 | +You can switch the PHP version of the docker runtime by changing the `PHP_VERSION` environment variable in the `.env` file. |
| 29 | + |
| 30 | +If you have no `.env` file yet, create it by copying `.env.dist` to `.env`. |
| 31 | + |
| 32 | +After changing the PHP Version you need to run `make clean_all up cli` or `make down up cli` to start the new container with new version. |
| 33 | + |
| 34 | +Example: |
| 35 | + |
| 36 | +``` |
| 37 | +$ echo "PHP_VERSION=8.2" > .env |
| 38 | +$ make down up cli |
| 39 | +docker-compose down --remove-orphans |
| 40 | +Stopping yii2-fractal_php_1 ... done |
| 41 | +Stopping yii2-fractal_pgsql_1 ... done |
| 42 | +Removing yii2-fractal_php_1 ... done |
| 43 | +Removing yii2-fractal_pgsql_1 ... done |
| 44 | +Removing network yii2-fractal_default |
| 45 | +docker-compose build |
| 46 | +... |
| 47 | +... |
| 48 | +... |
| 49 | +docker-compose up -d |
| 50 | +... |
| 51 | +... |
| 52 | +... |
| 53 | +docker-compose exec php bash |
| 54 | + _ _ __ _ |
| 55 | + (_|_)/ _| | | |
| 56 | + _ _ _ _| |_ _ __ __ _ _ __ ___ _____ _____ _ __| | __ |
| 57 | + | | | | | | _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ / |
| 58 | + | |_| | | | | | | | (_| | | | | | | __/\ V V / (_) | | | < |
| 59 | + \__, |_|_|_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\ |
| 60 | + __/ | |
| 61 | + |___/ |
| 62 | +
|
| 63 | +PHP version: 8.2.20 |
| 64 | +root@713d31b5ed8c:/app# |
| 65 | +``` |
0 commit comments