Skip to content

avosalmon/design-first-api

Repository files navigation

Design-First API Development in Laravel

API docs

API docs are available at https://avosalmon.stoplight.io/docs/design-first-api

System requirements

Make sure Docker is installed on your machine.

Setup local environment

This repository uses Laravel Sail for the local docker environment. You can use the sail command by configuring a bash alias below.

alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'

Install composer dependencies.

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs

Start docker compose

sail up -d

Generate app key and places inside the .env file

sail artisan key:generate

Run DB migration

sail artisan migrate:fresh --seed

Now you can access the app via http://localhost:8000.

To stop Docker containers

sail down

Testing

This repository uses Pest for writing tests. Pest is a testing framework with a simpler syntax like Jest and better reporting. Since it's powered by PHPUnit, it supports all the PHPUnit syntaxes as well.

Running tests

sail test

Filtering tests

sail test --filter ExampleTest

Display code coverage

sail test --coverage --min=80

About

Design-First API Development in Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published