/symfony5php8demo

a simple demo with symfony and php8

Primary LanguagePHP

start

cp .env .env.local
cp .env.test .env.test.local

edit file .env.local for docker variables

edit file .env.test.local for docker test variables

launch the container with the environment variables

env $(cat .env.local | command grep -i ^[A-Z] | xargs) docker-compose up -d

alternatively, MakeFile has been added to more easily manage console operations.
To start the project under development:

make start

To start build the project:

make build

To stop containers:

make stop

To stop containers and delete volumes:

make stop-with-volumes

To get the php service shell and run the commands from within:

make shell

install composer dependencies of the project

docker-compose run --rm -u www-data php php -d memory_limit=-1 /usr/local/bin/composer install

another interesting command, similar to the previous one, to be able to execute commands inside the container with the appropriate user is this:

docker exec --user=www-data nome_container command_to_exec

or:

make dependencies

Database creation and management

docker exec -it php_container_name /bin/bash
bin/console doctrine:database:create
bin/console doctrine:schema:validate
bin/console doctrine:schema:create

```bash
bin/console doctrine:schema:update --force