Simples projeto usando Docker com PHP 7.4, uma API com GraphQL e MySQL, PHPCS/PHPStan para lint dentre outros.
Plugins:
- GraphQL: https://github.com/rebing/graphql-laravel
- PHP Unit: https://github.com/sebastianbergmann/phpunit
docker-compose pull
docker-compose up -d
docker exec -it app php artisan config:clear
docker exec -it app php artisan migrate
Requisitos:
- https://laravel.com/docs/7.x#server-requirements
- PDO SQlite
- XDebug
- Criar um arquivo .env com as configurações do banco de dados
Rodar:
php artisan migrate
php artisan serve --host=127.0.0.1 --port=80
- Editor: http://localhost:80/graphiql
- Endpoint: http://localhost:80/graphql
- Depósito:
curl --location --request POST 'http://localhost:80/graphql' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "mutation { depositar(conta:1, valor:50.00) { conta, saldo } }"
}'
- Saque:
curl --location --request POST 'http://localhost:80/graphql' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "mutation { sacar(conta:1, valor:50.00) { conta, saldo } }"
}'
- Saldo:
curl --location --request POST 'http://localhost:80/graphql' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "query { saldo(conta:1) }"
}'
./vendor/bin/phpstan analyse ./app --level=1
./vendor/bin/phpcs --standard=PSR12 ./app
./vendor/bin/phpcbf --standard=PSR12 ./app
./vendor/bin/phpunit --coverage-html ./public/codecoverage
./vendor/bin/phpunit --coverage-text