This code runs the API of https://killerparty.app
Make sure that you have composer and PHP 8.2 minimum installed on your system.
Docker compose is recommended for database, although you can use PostgreSQL without container if you rather.
You will have to install Mercure binary as well.
$ composer install
Run database with docker-compose file :
$ docker-compose up -d
... Or with any other way you choose.
Then, create your database using this command :
$ bin/console doctrine:database:create
And run migrations (you can use quick notation as follow) :
$ bin/console do:mi:mi
This API is using JWT tokens to authenticate clients. A keypair must be generated in order to sign these JWTs. To do so, run :
$ bin/console lexik:jwt:generate-keypair --overwrite
To use SSE events with Mercure, start with downloading Mercure binary on the github release page, according to your dev environment.
Unzip the archive anywhere your want in your PC (not in this project).
Then, open Caddyfile.dev
and add this line above the route {
directive :
header Access-Control-Allow-Origin http://YOU-FRONT-END-APP-DOMAIN:PORT
To launch mercure, just launch this command :
$ MERCURE_PUBLISHER_JWT_KEY='dev-@1123581321-killer-mercure-secret' \
MERCURE_SUBSCRIBER_JWT_KEY='dev-@1123581321-killer-mercure-secret' \
./mercure run --config Caddyfile.dev
MERCURE_PUBLISHER_JWT_KEY
& MERCURE_SUBSCRIBER_JWT_KEY
must have the same value as the MERCURE_JWT_SECRET
in your .env
.
Check Mercure on this url : https://localhost/.well-known/mercure/ui/
You may have to authorize unsecure https
on this domain.
If you have the Symfony CLI, just run :
$ symfony serve
Otherwise, use just php and run :
$ php -S 127.0.0.1:8000 -t public
A Makefile is provided to ease tests & static analysis commands.
$ make phpcs
$ make phpstan
$ make phpstan
$ make unit-tests
$ make functional-tests