Skip to content

Commit fcb3a9f

Browse files
authored
Merge pull request #401 from dotkernel/issue-399
Issue #399: Merge `Admin.Core` into `API.Core`
2 parents 4ca88f6 + 4d9196e commit fcb3a9f

File tree

171 files changed

+2844
-1646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+2844
-1646
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ Documentation is available at: https://docs.dotkernel.org/api-documentation/
1313
## Badges
1414

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

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

23-
[![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)
23+
[![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)
2424
[![codecov](https://codecov.io/gh/dotkernel/api/graph/badge.svg?token=53FN78G5CK)](https://codecov.io/gh/dotkernel/api)
25-
[![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)
26-
[![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)
25+
[![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)
26+
[![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)
2727

2828
## Getting Started
2929

@@ -77,7 +77,7 @@ composer development-status
7777
* run the database migrations by using the following command:
7878

7979
```shell
80-
php vendor/bin/doctrine-migrations migrate
80+
php ./vendor/bin/doctrine-migrations migrate
8181
```
8282

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

9595
```shell
96-
php bin/doctrine fixtures:list
96+
php ./bin/doctrine fixtures:list
9797
```
9898

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

101101
To execute all fixtures, run:
102102

103103
```shell
104-
php bin/doctrine fixtures:execute
104+
php ./bin/doctrine fixtures:execute
105105
```
106106

107107
To execute a specific fixture, run:
108108

109109
```shell
110-
php bin/doctrine fixtures:execute --class=FixtureClassName
110+
php ./bin/doctrine fixtures:execute --class=FixtureClassName
111111
```
112112

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

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@
5757
"dotkernel/dot-dependency-injection": "^1.2",
5858
"dotkernel/dot-errorhandler": "^4.0.0",
5959
"dotkernel/dot-mail": "^5.3.0",
60-
"dotkernel/dot-response-header": "^3.4.1",
61-
"dotkernel/dot-router": "^1.0.4",
60+
"dotkernel/dot-response-header": "^3.5.0",
61+
"dotkernel/dot-router": "^1.0.5",
62+
"laminas/laminas-authentication": "^2.18",
6263
"laminas/laminas-component-installer": "^3.5.0",
6364
"laminas/laminas-config-aggregator": "^1.18.0",
6465
"laminas/laminas-hydrator": "^4.16.0",
@@ -70,21 +71,21 @@
7071
"mezzio/mezzio-authorization-rbac": "^1.8.0",
7172
"mezzio/mezzio-cors": "^1.13.0",
7273
"mezzio/mezzio-fastroute": "^3.12.0",
73-
"mezzio/mezzio-hal": "^2.10",
74+
"mezzio/mezzio-hal": "^2.10.1",
7475
"mezzio/mezzio-problem-details": "^1.15.0",
7576
"mezzio/mezzio-twigrenderer": "^2.17.0",
7677
"ramsey/uuid-doctrine": "^2.1.0",
7778
"roave/psr-container-doctrine": "^5.2.2",
7879
"symfony/filesystem": "^7.2.0",
79-
"zircote/swagger-php": "^5.0.6"
80+
"zircote/swagger-php": "^5.0.7"
8081
},
8182
"require-dev": {
8283
"laminas/laminas-coding-standard": "^3.0.1",
8384
"laminas/laminas-development-mode": "^3.13.0",
8485
"mezzio/mezzio-tooling": "^2.10.1",
85-
"phpstan/phpstan": "^2.1.7",
86+
"phpstan/phpstan": "^2.1.11",
8687
"phpstan/phpstan-doctrine": "^2.0.2",
87-
"phpstan/phpstan-phpunit": "^2.0.4",
88+
"phpstan/phpstan-phpunit": "^2.0.6",
8889
"phpunit/phpunit": "^10.5.45",
8990
"roave/security-advisories": "dev-latest",
9091
"symfony/var-dumper": "^7.2.3"
@@ -98,6 +99,7 @@
9899
"Core\\Admin\\": "src/Core/src/Admin/src/",
99100
"Core\\App\\": "src/Core/src/App/src/",
100101
"Core\\Security\\": "src/Core/src/Security/src/",
102+
"Core\\Setting\\": "src/Core/src/Setting/src/",
101103
"Core\\User\\": "src/Core/src/User/src/"
102104
}
103105
},

config/autoload/authorization.global.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use Core\Admin\Entity\AdminRole;
6-
use Core\User\Entity\UserRole;
5+
use Core\Admin\Enum\AdminRoleEnum;
6+
use Core\User\Enum\UserRoleEnum;
77

88
return [
99
/**
@@ -19,17 +19,17 @@
1919
*/
2020
'mezzio-authorization-rbac' => [
2121
'roles' => [
22-
AdminRole::ROLE_SUPERUSER => [],
23-
AdminRole::ROLE_ADMIN => [
24-
AdminRole::ROLE_SUPERUSER,
22+
AdminRoleEnum::Superuser->value => [],
23+
AdminRoleEnum::Admin->value => [
24+
AdminRoleEnum::Superuser->value,
2525
],
26-
UserRole::ROLE_GUEST => [
27-
UserRole::ROLE_USER,
26+
UserRoleEnum::Guest->value => [
27+
UserRoleEnum::User->value,
2828
],
2929
],
3030
'permissions' => [
31-
AdminRole::ROLE_SUPERUSER => [],
32-
AdminRole::ROLE_ADMIN => [
31+
AdminRoleEnum::Superuser->value => [],
32+
AdminRoleEnum::Admin->value => [
3333
'admin::list-admin',
3434
'admin::create-admin',
3535
'admin::delete-admin',
@@ -54,15 +54,15 @@
5454
'app::create-error-report',
5555
'app::view-index',
5656
],
57-
UserRole::ROLE_USER => [
57+
UserRoleEnum::User->value => [
5858
'user::delete-account',
5959
'user::view-account',
6060
'user::update-account',
6161
'user::delete-account-avatar',
6262
'user::view-account-avatar',
6363
'user::create-account-avatar',
6464
],
65-
UserRole::ROLE_GUEST => [
65+
UserRoleEnum::Guest->value => [
6666
'app::create-error-report',
6767
'app::view-index',
6868
'user::activate-account',

config/autoload/cli.global.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
declare(strict_types=1);
44

55
use Api\Admin\Command\AdminCreateCommand;
6-
use Api\App\Command\RouteListCommand;
76
use Api\App\Command\TokenGenerateCommand;
8-
use Dot\Cli\Command\DemoCommand;
7+
use Core\App\Command\RouteListCommand;
98
use Dot\Cli\FileLockerInterface;
109

1110
return [
1211
'dot_cli' => [
1312
'version' => '1.0.0',
1413
'name' => 'Dotkernel CLI',
1514
'commands' => [
16-
DemoCommand::getDefaultName() => DemoCommand::class,
1715
RouteListCommand::getDefaultName() => RouteListCommand::class,
1816
AdminCreateCommand::getDefaultName() => AdminCreateCommand::class,
1917
TokenGenerateCommand::getDefaultName() => TokenGenerateCommand::class,

config/autoload/content-negotiation.global.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
return [
66
'content-negotiation' => [
7-
'default' => [ // default to any route if not configured above
7+
'default' => [ // default to any route if not configured above
88
'Accept' => [ // the Accept is what format the server can send back
99
'application/json',
1010
'application/hal+json',
@@ -14,11 +14,11 @@
1414
'application/hal+json',
1515
],
1616
],
17-
'your.route.name' => [
17+
'your.route.name' => [
1818
'Accept' => [],
1919
'Content-Type' => [],
2020
],
21-
'user.avatar.create' => [
21+
'user::create-account-avatar' => [
2222
'Accept' => [
2323
'application/json',
2424
'application/hal+json',
@@ -27,7 +27,7 @@
2727
'multipart/form-data',
2828
],
2929
],
30-
'user.my-avatar.create' => [
30+
'user::create-user-avatar' => [
3131
'Accept' => [
3232
'application/json',
3333
'application/hal+json',

config/autoload/local.php.dist

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,36 @@ $baseUrl = 'http://localhost:8080';
77
$databases = [
88
'default' => [
99
'host' => 'localhost',
10-
'dbname' => '',
10+
'dbname' => 'dotkernel',
1111
'user' => '',
1212
'password' => '',
1313
'port' => 3306,
1414
'driver' => 'pdo_mysql',
1515
'charset' => 'utf8mb4',
1616
'collate' => 'utf8mb4_general_ci',
1717
],
18-
// you can add more database connections into this array
18+
// you can add more database connections to this array
1919
];
2020

2121
return [
2222
'application' => [
2323
'name' => 'Dotkernel API',
24+
'version' => 6,
2425
'url' => $baseUrl,
2526
'versioning' => [
2627
'documentation_url' => 'https://docs.dotkernel.org/api-documentation/v5/core-features/versioning',
2728
],
2829
],
2930
'authentication' => [
3031
'private_key' => [
31-
'key_or_path' => getcwd() . '/data/oauth/private.key',
32+
'key_or_path' => realpath(__DIR__ . '/../../data/oauth/private.key'),
3233
'key_permissions_check' => false,
3334
],
3435
'public_key' => [
35-
'key_or_path' => getcwd() . '/data/oauth/public.key',
36+
'key_or_path' => realpath(__DIR__ . '/../../data/oauth/public.key'),
3637
'key_permissions_check' => false,
3738
],
38-
'encryption_key' => require getcwd() . '/data/oauth/encryption.key',
39+
'encryption_key' => require realpath(__DIR__ . '/../../data/oauth/encryption.key'),
3940
'access_token_expire' => 'P1D',
4041
'refresh_token_expire' => 'P1M',
4142
'auth_code_expire' => 'PT10M',

config/config.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
];
1111

1212
$aggregator = new Laminas\ConfigAggregator\ConfigAggregator([
13+
// Laminas packages
14+
Laminas\Diactoros\ConfigProvider::class,
15+
Laminas\InputFilter\ConfigProvider::class,
16+
Laminas\Filter\ConfigProvider::class,
17+
Laminas\HttpHandlerRunner\ConfigProvider::class,
18+
Laminas\Hydrator\ConfigProvider::class,
19+
Laminas\Validator\ConfigProvider::class,
20+
21+
// Mezzio packages
1322
Mezzio\Authorization\ConfigProvider::class,
1423
Mezzio\Authorization\Acl\ConfigProvider::class,
1524
Mezzio\Authorization\Rbac\ConfigProvider::class,
@@ -20,14 +29,6 @@
2029
Mezzio\ProblemDetails\ConfigProvider::class,
2130
Mezzio\Router\FastRouteRouter\ConfigProvider::class,
2231
Mezzio\Twig\ConfigProvider::class,
23-
Laminas\Diactoros\ConfigProvider::class,
24-
Laminas\InputFilter\ConfigProvider::class,
25-
Laminas\Filter\ConfigProvider::class,
26-
Laminas\HttpHandlerRunner\ConfigProvider::class,
27-
Laminas\Hydrator\ConfigProvider::class,
28-
Laminas\Validator\ConfigProvider::class,
29-
// Include cache configuration
30-
new Laminas\ConfigAggregator\ArrayProvider($cacheConfig),
3132
Mezzio\Helper\ConfigProvider::class,
3233
Mezzio\ConfigProvider::class,
3334
Mezzio\Router\ConfigProvider::class,
@@ -37,6 +38,9 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
3738
return [];
3839
},
3940

41+
// Include cache configuration
42+
new Laminas\ConfigAggregator\ArrayProvider($cacheConfig),
43+
4044
// DK packages
4145
Dot\Cli\ConfigProvider::class,
4246
Dot\Log\ConfigProvider::class,
@@ -48,22 +52,24 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
4852
Dot\Cache\ConfigProvider::class,
4953
Dot\Router\ConfigProvider::class,
5054

51-
// Default App module config
52-
Core\Admin\ConfigProvider::class,
53-
Core\App\ConfigProvider::class,
54-
Core\Security\ConfigProvider::class,
55-
Core\User\ConfigProvider::class,
55+
// Dotkernel modules
5656
Api\Admin\ConfigProvider::class,
5757
Api\App\ConfigProvider::class,
5858
Api\Security\ConfigProvider::class,
5959
Api\User\ConfigProvider::class,
60+
Core\Admin\ConfigProvider::class,
61+
Core\App\ConfigProvider::class,
62+
Core\Security\ConfigProvider::class,
63+
Core\Setting\ConfigProvider::class,
64+
Core\User\ConfigProvider::class,
6065

6166
// Load application config in a pre-defined order in such a way that local settings
6267
// overwrite global settings. (Loaded as first to last):
6368
// - `global.php`
6469
// - `*.global.php`
6570
// - `local.php`
6671
// - `*.local.php`
72+
// - `local.test.php`
6773
new Laminas\ConfigAggregator\PhpFileProvider(
6874
realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local,{,*.}test}.php'
6975
),

0 commit comments

Comments
 (0)