Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ Documentation is available at: https://docs.dotkernel.org/api-documentation/
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/api)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/api/5.2.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/api/6.0.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/api)](https://github.com/dotkernel/api/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/api)](https://github.com/dotkernel/api/network)
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/api)](https://github.com/dotkernel/api/stargazers)
[![GitHub license](https://img.shields.io/github/license/dotkernel/api)](https://github.com/dotkernel/api/blob/5.0/LICENSE.md)
[![GitHub license](https://img.shields.io/github/license/dotkernel/api)](https://github.com/dotkernel/api/blob/6.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/api/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/api/actions/workflows/continuous-integration.yml)
[![Build Static](https://github.com/dotkernel/api/actions/workflows/continuous-integration.yml/badge.svg?branch=6.0)](https://github.com/dotkernel/api/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/api/graph/badge.svg?token=53FN78G5CK)](https://codecov.io/gh/dotkernel/api)
[![Qodana](https://github.com/dotkernel/api/actions/workflows/qodana_code_quality.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/api/actions/workflows/qodana_code_quality.yml)
[![PHPStan](https://github.com/dotkernel/api/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/api/actions/workflows/static-analysis.yml)
[![Qodana](https://github.com/dotkernel/api/actions/workflows/qodana_code_quality.yml/badge.svg?branch=6.0)](https://github.com/dotkernel/api/actions/workflows/qodana_code_quality.yml)
[![PHPStan](https://github.com/dotkernel/api/actions/workflows/static-analysis.yml/badge.svg?branch=6.0)](https://github.com/dotkernel/api/actions/workflows/static-analysis.yml)

## Getting Started

Expand Down Expand Up @@ -77,7 +77,7 @@ composer development-status
* run the database migrations by using the following command:

```shell
php vendor/bin/doctrine-migrations migrate
php ./vendor/bin/doctrine-migrations migrate
```

This command will prompt you to confirm that you want to run it:
Expand All @@ -93,21 +93,21 @@ Hit `Enter` to confirm the operation.
To list all the fixtures, run:

```shell
php bin/doctrine fixtures:list
php ./bin/doctrine fixtures:list
```

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

To execute all fixtures, run:

```shell
php bin/doctrine fixtures:execute
php ./bin/doctrine fixtures:execute
```

To execute a specific fixture, run:

```shell
php bin/doctrine fixtures:execute --class=FixtureClassName
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
Expand Down
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
"dotkernel/dot-dependency-injection": "^1.2",
"dotkernel/dot-errorhandler": "^4.0.0",
"dotkernel/dot-mail": "^5.3.0",
"dotkernel/dot-response-header": "^3.4.1",
"dotkernel/dot-router": "^1.0.4",
"dotkernel/dot-response-header": "^3.5.0",
"dotkernel/dot-router": "^1.0.5",
"laminas/laminas-authentication": "^2.18",
"laminas/laminas-component-installer": "^3.5.0",
"laminas/laminas-config-aggregator": "^1.18.0",
"laminas/laminas-hydrator": "^4.16.0",
Expand All @@ -70,21 +71,21 @@
"mezzio/mezzio-authorization-rbac": "^1.8.0",
"mezzio/mezzio-cors": "^1.13.0",
"mezzio/mezzio-fastroute": "^3.12.0",
"mezzio/mezzio-hal": "^2.10",
"mezzio/mezzio-hal": "^2.10.1",
"mezzio/mezzio-problem-details": "^1.15.0",
"mezzio/mezzio-twigrenderer": "^2.17.0",
"ramsey/uuid-doctrine": "^2.1.0",
"roave/psr-container-doctrine": "^5.2.2",
"symfony/filesystem": "^7.2.0",
"zircote/swagger-php": "^5.0.6"
"zircote/swagger-php": "^5.0.7"
},
"require-dev": {
"laminas/laminas-coding-standard": "^3.0.1",
"laminas/laminas-development-mode": "^3.13.0",
"mezzio/mezzio-tooling": "^2.10.1",
"phpstan/phpstan": "^2.1.7",
"phpstan/phpstan": "^2.1.11",
"phpstan/phpstan-doctrine": "^2.0.2",
"phpstan/phpstan-phpunit": "^2.0.4",
"phpstan/phpstan-phpunit": "^2.0.6",
"phpunit/phpunit": "^10.5.45",
"roave/security-advisories": "dev-latest",
"symfony/var-dumper": "^7.2.3"
Expand All @@ -98,6 +99,7 @@
"Core\\Admin\\": "src/Core/src/Admin/src/",
"Core\\App\\": "src/Core/src/App/src/",
"Core\\Security\\": "src/Core/src/Security/src/",
"Core\\Setting\\": "src/Core/src/Setting/src/",
"Core\\User\\": "src/Core/src/User/src/"
}
},
Expand Down
22 changes: 11 additions & 11 deletions config/autoload/authorization.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use Core\Admin\Entity\AdminRole;
use Core\User\Entity\UserRole;
use Core\Admin\Enum\AdminRoleEnum;
use Core\User\Enum\UserRoleEnum;

return [
/**
Expand All @@ -19,17 +19,17 @@
*/
'mezzio-authorization-rbac' => [
'roles' => [
AdminRole::ROLE_SUPERUSER => [],
AdminRole::ROLE_ADMIN => [
AdminRole::ROLE_SUPERUSER,
AdminRoleEnum::Superuser->value => [],
AdminRoleEnum::Admin->value => [
AdminRoleEnum::Superuser->value,
],
UserRole::ROLE_GUEST => [
UserRole::ROLE_USER,
UserRoleEnum::Guest->value => [
UserRoleEnum::User->value,
],
],
'permissions' => [
AdminRole::ROLE_SUPERUSER => [],
AdminRole::ROLE_ADMIN => [
AdminRoleEnum::Superuser->value => [],
AdminRoleEnum::Admin->value => [
'admin::list-admin',
'admin::create-admin',
'admin::delete-admin',
Expand All @@ -54,15 +54,15 @@
'app::create-error-report',
'app::view-index',
],
UserRole::ROLE_USER => [
UserRoleEnum::User->value => [
'user::delete-account',
'user::view-account',
'user::update-account',
'user::delete-account-avatar',
'user::view-account-avatar',
'user::create-account-avatar',
],
UserRole::ROLE_GUEST => [
UserRoleEnum::Guest->value => [
'app::create-error-report',
'app::view-index',
'user::activate-account',
Expand Down
4 changes: 1 addition & 3 deletions config/autoload/cli.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
declare(strict_types=1);

use Api\Admin\Command\AdminCreateCommand;
use Api\App\Command\RouteListCommand;
use Api\App\Command\TokenGenerateCommand;
use Dot\Cli\Command\DemoCommand;
use Core\App\Command\RouteListCommand;
use Dot\Cli\FileLockerInterface;

return [
'dot_cli' => [
'version' => '1.0.0',
'name' => 'Dotkernel CLI',
'commands' => [
DemoCommand::getDefaultName() => DemoCommand::class,
RouteListCommand::getDefaultName() => RouteListCommand::class,
AdminCreateCommand::getDefaultName() => AdminCreateCommand::class,
TokenGenerateCommand::getDefaultName() => TokenGenerateCommand::class,
Expand Down
8 changes: 4 additions & 4 deletions config/autoload/content-negotiation.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [
'content-negotiation' => [
'default' => [ // default to any route if not configured above
'default' => [ // default to any route if not configured above
'Accept' => [ // the Accept is what format the server can send back
'application/json',
'application/hal+json',
Expand All @@ -14,11 +14,11 @@
'application/hal+json',
],
],
'your.route.name' => [
'your.route.name' => [
'Accept' => [],
'Content-Type' => [],
],
'user.avatar.create' => [
'user::create-account-avatar' => [
'Accept' => [
'application/json',
'application/hal+json',
Expand All @@ -27,7 +27,7 @@
'multipart/form-data',
],
],
'user.my-avatar.create' => [
'user::create-user-avatar' => [
'Accept' => [
'application/json',
'application/hal+json',
Expand Down
11 changes: 6 additions & 5 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,36 @@ $baseUrl = 'http://localhost:8080';
$databases = [
'default' => [
'host' => 'localhost',
'dbname' => '',
'dbname' => 'dotkernel',
'user' => '',
'password' => '',
'port' => 3306,
'driver' => 'pdo_mysql',
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_general_ci',
],
// you can add more database connections into this array
// you can add more database connections to this array
];

return [
'application' => [
'name' => 'Dotkernel API',
'version' => 6,
'url' => $baseUrl,
'versioning' => [
'documentation_url' => 'https://docs.dotkernel.org/api-documentation/v5/core-features/versioning',
],
],
'authentication' => [
'private_key' => [
'key_or_path' => getcwd() . '/data/oauth/private.key',
'key_or_path' => realpath(__DIR__ . '/../../data/oauth/private.key'),
'key_permissions_check' => false,
],
'public_key' => [
'key_or_path' => getcwd() . '/data/oauth/public.key',
'key_or_path' => realpath(__DIR__ . '/../../data/oauth/public.key'),
'key_permissions_check' => false,
],
'encryption_key' => require getcwd() . '/data/oauth/encryption.key',
'encryption_key' => require realpath(__DIR__ . '/../../data/oauth/encryption.key'),
'access_token_expire' => 'P1D',
'refresh_token_expire' => 'P1M',
'auth_code_expire' => 'PT10M',
Expand Down
32 changes: 19 additions & 13 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
];

$aggregator = new Laminas\ConfigAggregator\ConfigAggregator([
// Laminas packages
Laminas\Diactoros\ConfigProvider::class,
Laminas\InputFilter\ConfigProvider::class,
Laminas\Filter\ConfigProvider::class,
Laminas\HttpHandlerRunner\ConfigProvider::class,
Laminas\Hydrator\ConfigProvider::class,
Laminas\Validator\ConfigProvider::class,

// Mezzio packages
Mezzio\Authorization\ConfigProvider::class,
Mezzio\Authorization\Acl\ConfigProvider::class,
Mezzio\Authorization\Rbac\ConfigProvider::class,
Expand All @@ -20,14 +29,6 @@
Mezzio\ProblemDetails\ConfigProvider::class,
Mezzio\Router\FastRouteRouter\ConfigProvider::class,
Mezzio\Twig\ConfigProvider::class,
Laminas\Diactoros\ConfigProvider::class,
Laminas\InputFilter\ConfigProvider::class,
Laminas\Filter\ConfigProvider::class,
Laminas\HttpHandlerRunner\ConfigProvider::class,
Laminas\Hydrator\ConfigProvider::class,
Laminas\Validator\ConfigProvider::class,
// Include cache configuration
new Laminas\ConfigAggregator\ArrayProvider($cacheConfig),
Mezzio\Helper\ConfigProvider::class,
Mezzio\ConfigProvider::class,
Mezzio\Router\ConfigProvider::class,
Expand All @@ -37,6 +38,9 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
return [];
},

// Include cache configuration
new Laminas\ConfigAggregator\ArrayProvider($cacheConfig),

// DK packages
Dot\Cli\ConfigProvider::class,
Dot\Log\ConfigProvider::class,
Expand All @@ -48,22 +52,24 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
Dot\Cache\ConfigProvider::class,
Dot\Router\ConfigProvider::class,

// Default App module config
Core\Admin\ConfigProvider::class,
Core\App\ConfigProvider::class,
Core\Security\ConfigProvider::class,
Core\User\ConfigProvider::class,
// Dotkernel modules
Api\Admin\ConfigProvider::class,
Api\App\ConfigProvider::class,
Api\Security\ConfigProvider::class,
Api\User\ConfigProvider::class,
Core\Admin\ConfigProvider::class,
Core\App\ConfigProvider::class,
Core\Security\ConfigProvider::class,
Core\Setting\ConfigProvider::class,
Core\User\ConfigProvider::class,

// Load application config in a pre-defined order in such a way that local settings
// overwrite global settings. (Loaded as first to last):
// - `global.php`
// - `*.global.php`
// - `local.php`
// - `*.local.php`
// - `local.test.php`
new Laminas\ConfigAggregator\PhpFileProvider(
realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local,{,*.}test}.php'
),
Expand Down
Loading