This project uses Sail.
Please install Docker in order to start using Sail.
Install project dependencies:
composer install
Setup env:
cp .env.example .env
./vendor/bin/sail artisan key:generate
Update hosts file:
127.0.0.1 recurrent-events-app.local
Startup services:
./vendor/bin/sail up -d # Up on port 8080
Check service status:
curl http://recurrent-events-app.local:8080/api/health
Migrate and seed database:
./vendor/bin/sail artisan migrate
./vendor/bin/sail artisan db:seed
Generate swagger page
./vendor/bin/sail artisan l5-swagger:generate
Open http://recurrent-events-app.local:8080/api to browse Swagger page.
Route: events.index
curl -X 'GET' \
'http://recurrent-events-app.local:8080/api/events' \
-H 'Accept: application/json'
Route: events.show
curl -X 'GET' \
'http://recurrent-events-app.local:8080/api/events/1' \
-H 'Accept: application/json'
Route: events.store
curl -X 'POST' \
'http://recurrent-events-app.local:8080/api/events' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'X-CSRF-TOKEN: ' \
-d '{
"title": "string",
"description": "string",
"starts_at": "2024-01-10T10:00:00+00:00",
"ends_at": "2024-01-10T17:00:00+00:00",
"recurrent": false,
"frequency": "daily",
"repeat_until": "2024-01-10T22:00:00+00:00"
}'
Route: events.update
curl -X 'PUT' \
'http://recurrent-events-app.local:8080/api/events/1' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'X-CSRF-TOKEN: ' \
-d '{
"title": "string",
"description": "string",
"starts_at": "2024-01-10T10:00:00+00:00",
"ends_at": "2024-01-10T17:00:00+00:00",
"recurrent": false,
"frequency": "daily",
"repeat_until": "2024-01-10T22:00:00+00:00"
}'
Route: events.destroy
curl -X 'DELETE' \
'http://recurrent-events-app.local:8080/api/events/1' \
-H 'Accept: application/json'
Validate code style
./vendor/bin/sail composer check-code
Run tests
./vendor/bin/sail artisan test
To be able to run PhpUnit in the container make sure you have the container running.
Then make sure you configure Docker:
Make sure you configure PHP with remote interpreter.
Then configure the PhpUnit interpreter.
To enable Xdebug you have to set correct debug port: 9003 - Settings -> PHP -> XDEBUG
Also need to configure server: Settings -> PHP -> Servers