This project gives users the ability to import a log file and count logs based on a set of queries.
⚠️ Before anything else, you need to setup your .env file first. Both Docker Compose and the project needs it in order to work properly
First, copy the .env
file to yours:
cp .env .env.local
then in your .env.local
file, supply the following environment variables:
POSTGRES_USER
example:myusername
POSTGRES_PASSWORD
example:mypassword
POSTGRES_DB
example:mydatabase
SERVER_NAME
example:analytics.logging-system.localhost
After that, you can proceed with the next steps.
This project uses Docker Compose for development, and can be started up by simply running the following:
docker compose --env-file ./.env.local build
docker compose --env-file ./.env.local up -d
Once the containers are up and running, you can now install the dependencies by entering the php
container:
docker compose exec -it php /bin/bash
and installing the Composer packages:
composer install
Once you have installed the Composer packages, you can start creating the test database for the unit tests to work.
php bin/console doctrine:database:create --env=test
💡️ Since our compose file already created our local database for us, we won't have to run this command for it.
Then, we can start running the migrations
php bin/console doctrine:migrations:migrate
php bin/console doctrine:migrations:migrate --env=test
Tests can be run by entering the php
container again:
docker compose exec -it php /bin/bash
and running:
php bin/phpunit
We have PHP_CodeSniffer installed to ensure that our code always matches our standards. You can run it by:
vendor/bin/phpcs
and fix any errors automatically by running:
vendor/bin/phpcbf
We have installed PHPStan to help with our code reviews! Simply run this command in order to check for bugs earlier in the code review pipeline:
vendor/bin/phpstan
The page can be accessed at the SERVER_NAME
environment variable you supplied in your .env.local
file.
Find out more about how this command is used here.