dotkernel / api

DotKernel's PSR-7 REST style API built around the Mezzio API skeleton.
https://docs.dotkernel.org/api-documentation/
MIT License
35 stars 5 forks source link
laminas mezzio mezzio-api-skeleton psr-7 rest-api restful-api

DotKernel API

Based on Enrico Zimuel's Zend Expressive API - Skeleton example, DotKernel API runs on Laminas and Mezzio components and implements standards like PSR-3, PSR-4, PSR-7, PSR-11 and PSR-15.

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static codecov Qodana

SymfonyInsight

Getting Started

Step 1: Clone the project

Using your terminal, navigate inside the directory you want to download the project files into. Make sure that the directory is empty before proceeding to the download process. Once there, run the following command:

git clone https://github.com/dotkernel/api.git .

Step 2: Install project's dependencies

composer install

Step 3: Development mode

If you're installing the project for development, make sure you have development mode enabled, by running:

composer development-enable

You can disable development mode by running:

composer development-disable

You can check if you have development mode enabled by running:

composer development-status

Step 4: Prepare config files

Step 5: Setup database

Running migrations

This command will prompt you to confirm that you want to run it:

WARNING! You are about to execute a migration in database "..." that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:

Hit Enter to confirm the operation.

Executing fixtures

Fixtures are used to seed the database with initial values and should be executed after migrating the database.

To list all the fixtures, run:

php bin/doctrine fixtures:list

This will output all the fixtures in the order of execution.

To execute all fixtures, run:

php bin/doctrine fixtures:execute

To execute a specific fixture, run:

php bin/doctrine fixtures:execute --class=FixtureClassName

More details on how fixtures work can be found here: https://github.com/dotkernel/dot-data-fixtures#creating-fixtures

Step 6: Test the installation

php -S 0.0.0.0:8080 -t public

Sending a GET request to the home page should output the following message:

{
"message": "DotKernel API version 5"
}

Documentation

In order to access DotKernel API documentation, check the provided readme file.

Additionally, each CLI command available has it's own documentation: