Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dotkernel's PSR-7 and PSR-15 REST API built around the Mezzio API skeleton.

License

NotificationsYou must be signed in to change notification settings

dotkernel/api

Repository files navigation

Dotkernel API is a PHP skeleton app for building REST APIs usingLaminas andMezzio components and implements standards like PSR-3, PSR-4, PSR-7, PSR-11 and PSR-15.

Dotkernel API is an alternative for legacy Laminas API Tools (formerly Apigility) applications and is based on Enrico Zimuel'sZend Expressive API - Skeleton example.

Livedemo.

Documentation

Documentation is available at:https://docs.dotkernel.org/api-documentation/

Badges

OSS LifecyclePHP from Packagist (specify version)

GitHub issuesGitHub forksGitHub starsGitHub license

Build StaticcodecovQodanaPHPStan

Getting Started

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.

Install the project dependencies

composer install

Development mode

Do not enable development mode in production!

If you're installing the project for development, you shouldenable development mode by running:

composer development-enable

You candisable development mode by running:

composer development-disable

You cancheck the development status by running:

composer development-status

Prepare config files

  • duplicateconfig/autoload/cors.local.php.dist asconfig/autoload/cors.local.php <- if your API is consumed by another application, make sure configure theallowed_origins
  • duplicateconfig/autoload/local.php.dist asconfig/autoload/local.php
  • optional: to run/create tests, duplicateconfig/autoload/local.test.php.dist asconfig/autoload/local.test.php <- this creates a new in-memory database that your tests will run on

Setup database

Use an existing empty one or create a newMariaDB/MySQL database.

Recommended collation:utf8mb4_general_ci.

Running migrations

  • fill out the database connection params inconfig/autoload/local.php under$databases['default']
  • run the database migrations by using the following command:
php ./vendor/bin/doctrine-migrations migrate

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

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

HitEnter to confirm the operation.

Executing fixtures

Fixtures are used to seed the database with initial values and must 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 indotkernel/dot-data-fixturesdocumentation.

Mail configuration

If your application sends emails, you must configure an outgoing mail server underconfig/autoload/mail.global.php.

Test the installation

Run the following command in your project's directory to start PHPs built-in server:

php -S 0.0.0.0:8080 -t public

Running commandcomposer serve will do the same thing, but the server will time out after a couple of minutes.

Sending aGET request to the application'shome page should output the following message:

{"message":"Dotkernel API version 6"}

About

Dotkernel's PSR-7 and PSR-15 REST API built around the Mezzio API skeleton.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors9

Languages


[8]ページ先頭

©2009-2025 Movatter.jp