- After cloning project you need to run composer packages installation:
docker run --rm \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/var/www/html" \ -w /var/www/html \ laravelsail/php83-composer:latest \ composer install --ignore-platform-reqs
- As Docker containers this project uses the Laravel Sail package. To run it you need:
- copy '.env.example' file to '.env'. This environment file contains set up of container services ports, allowing running without conflicts.
- start containers:
- if you have configured 'sail' command alias in your '.bashrc', you can run
sail up -d
- otherwise run
./vendor/bin/sail up -d
- if you have configured 'sail' command alias in your '.bashrc', you can run
- run migrations and seeders accordingly to previous containers start command
./vendor/bin/sail artisan migrate --seed
orsail artisan migrate --seed
- In some cases you may need to set
chmod -R 777 storage/logs
- The documentation described by 'openapi.yaml' file you can find in project's root directory.
- To see it just open that file by PhpStorm in the 'Preview' mode.
- Also, you can use OpenAPI editor by Swagger.
- In this case, you must open a local 'openapi.yaml' file in Swagger Editor. Then you can make requests to API endpoints.
- First, you need to authorize user by picking 'Login user and create token' point.
- Then, click 'Try it out' button
- In the fields below enter email and password:
- You can use
start-user@mail.org
or email from DB table 'users'; - The password of any user seeded at installation step is 'password' for simple testing.
- Remember, that the access token is valid for 60 minutes. After that, you need to authenticate anew.
- If you feel that after numerous queries you have too many access tokens, you can prune the table by running the command
sail artisan sanctum:prune-expired --hours=24
that removes all old (expired) tokens.
- You can use
- When logged in, you'll see the Bearer token in the 'Response body' below. Use this one for authorizing any other endpoints.
- The authorization of all endpoints should be done like this:
- Copy authorization token from 'login' response body, something like this 6|hNK6Tr3n8DVuBm8eKFcew6iVBSYvRqJUD81LKe5f63fb4e54 - without quotes.
- At the top of page hit the green button 'Authorize'.
- Paste the copied token in the opened pop-up . That's enough.
- For example, you want to see some 'task'. Open tab 'Get task details' and hit 'Try it out' button, then fill the field ID with ID you want.
- Then hit the blue button 'Execute'. See the result in the Response body field below.
- Filtering and sorting are realized by separate end-points. These queries select data of authenticated user tasks only.