dotkernel / api
DotKernel API
Installs: 29
Dependents: 0
Suggesters: 0
Security: 0
Stars: 38
Watchers: 11
Forks: 4
Open Issues: 25
Type:project
Requires
- php: ~8.2.0 || ~8.3.0
- ext-gd: *
- ext-json: *
- dotkernel/dot-cache: ^4.0
- dotkernel/dot-cli: ^3.5.0
- dotkernel/dot-data-fixtures: ^1.2.2
- dotkernel/dot-dependency-injection: ^1.0
- dotkernel/dot-errorhandler: ^4.0.0
- dotkernel/dot-mail: ^4.1.1
- dotkernel/dot-response-header: ^3.2.3
- laminas/laminas-component-installer: ^3.4.0
- laminas/laminas-config-aggregator: ^1.14.0
- laminas/laminas-hydrator: ^4.15.0
- laminas/laminas-inputfilter: ^2.29.0
- laminas/laminas-stdlib: ^3.19.0
- mezzio/mezzio: ^3.19.0
- mezzio/mezzio-authentication-oauth2: ^2.8.0
- mezzio/mezzio-authorization-acl: ^1.10.0
- mezzio/mezzio-authorization-rbac: ^1.7.0
- mezzio/mezzio-cors: ^1.11.1
- mezzio/mezzio-fastroute: ^3.11.0
- mezzio/mezzio-hal: ^2.9
- mezzio/mezzio-problem-details: ^1.13.1
- mezzio/mezzio-twigrenderer: ^2.15.0
- ramsey/uuid-doctrine: ^2.1.0
- roave/psr-container-doctrine: ^5.2.1
- symfony/filesystem: ^7.0.3
- zircote/swagger-php: ^4.10
Requires (Dev)
- laminas/laminas-coding-standard: ^2.5
- laminas/laminas-development-mode: ^3.12.0
- laminas/laminas-http: ^2.19.0
- mezzio/mezzio-tooling: ^2.9.0
- phpstan/phpstan: ^2.0
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^10.5.10
- roave/security-advisories: dev-latest
- symfony/var-dumper: ^7.1
This package is auto-updated.
Last update: 2024-12-12 21:21:17 UTC
README
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.
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
- duplicate
config/autoload/cors.local.php.dist
asconfig/autoload/cors.local.php
<- if your API will be consumed by another application, make sure configure theallowed_origins
- duplicate
config/autoload/local.php.dist
asconfig/autoload/local.php
- duplicate
config/autoload/mail.local.php.dist
asconfig/autoload/mail.local.php
<- if your API will send emails, make sure you fill in SMTP connection params - optional: in order to run/create tests, duplicate
config/autoload/local.test.php.dist
asconfig/autoload/local.test.php
<- this creates a new in-memory database that your tests will run on
Step 5: Setup database
Running migrations
-
create a new MySQL database - set collation to
utf8mb4_general_ci
-
fill out the database connection params in
config/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 "..." 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: