Skip to content

Files

api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 4, 2024
Jan 14, 2025
Jan 18, 2025
Feb 11, 2025
Sep 28, 2024
Jan 14, 2025
Nov 11, 2023
Apr 18, 2022
Feb 11, 2025
Aug 17, 2024
Jan 18, 2025
Aug 17, 2024
Jul 29, 2021
May 4, 2024
Aug 27, 2024
Apr 13, 2024
Nov 18, 2023
Jan 14, 2025
May 1, 2023
Feb 11, 2025
Oct 10, 2023
Feb 15, 2025
Feb 15, 2025
Jan 14, 2025
Nov 23, 2024
Nov 23, 2024
Nov 23, 2024
Feb 4, 2023
Apr 13, 2022
Jan 14, 2025

eCamp v3 API

After starting the project using docker compose up -d, you can visit the API documentation in the browser at http://localhost:3000/api

To use the API, you will need to log in. You can use the "Login" endpoint offered in the Swagger UI for this. The example credentials should work fine in development.

Manually using the API without a browser

If you ever need to get an API token for manual use, you can use the following command:

docker compose exec php bin/console lexik:jwt:generate-token [email protected] --no-debug

The token must then be split and sent in two cookies to the API. The header and payload (from ey until before the second period .) must be sent in a cookie named [api-domain]_jwt_hp. The signature (everything after the second period .) must be sent in a cookie called [api-domain]_jwt_s (replace [api-domain] with the domain where the API is served, e.g. localhost_jwt_hp or pr1234.ecamp3.ch_jwt_s). See https://jwt.io for more info on the structure of JWT tokens, and https://medium.com/lightrail/getting-token-authentication-right-in-a-stateless-single-page-application-57d0c6474e3 for more info on why this split cookie approach is a good idea for SPAs.

Code quality

We are using the following toolchain to ensure code quality standards:

  • PHP CS Fixer
    Run
    docker compose exec php composer cs-fix
    before committing
    cs-check is integrated into CI (pull request will not pass)
  • Phpstan
    Run
    docker compose exec php composer phpstan
    phpstan is integrated into CI (pull request will not pass)
  • Psalm
    Run
    docker compose exec php composer psalm
    psalm is integrated into CI (pull request will not pass)

Debugging

For debugging you need to add the env variables XDEBUG_MODE and XDEBUG_CONFIG for xdebug in $REPOSITORY_ROOT/.env
XDEBUG_MODE=debug,coverage
Additional possible value: trace
For phpstorm:
XDEBUG_CONFIG="client_host=docker-host idekey=PHPSTORM log_level=0"
For vscode:
XDEBUG_CONFIG="client_host=docker-host idekey=VSCODE log_level=0"

After you changed the .env file, you need to recreate the container that the change has an effect.

docker compose down && docker compose up

or

docker-compsoe stop php; docker compose rm php; docker compose up

if you don't want to restart the frontend.