Skip to content

Commit 253e587

Browse files
authored
Merge pull request #16 from dotkernel/develop
Develop
2 parents 6201879 + 0d8c179 commit 253e587

90 files changed

Lines changed: 596 additions & 430 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
## 0.2.0 - 2017-03-22
2+
3+
ZE2 migration
4+
5+
### Changed
6+
* updated factories to PSR11 container and middleware to PSR15
7+
* refactored folder structure to follow modular application design a la ZE2
8+
* programmatic pipeline and routes
9+
* restructured application to match ZE2 structure
10+
11+
### Added
12+
* Nothing
13+
14+
### Deprecated
15+
* Nothing
16+
17+
### Removed
18+
* Nothing
19+
20+
### Fixed
21+
* Nothing
22+
23+
124
## 0.1.1 - 2017-03-12
225

326
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Dotkernel web starter package suitable for admin applications.
66

77
Create a new project directory and change dir to it. Run the following composer command
88
```bash
9-
$ composer create-project -s dev dotkernel/dot-admin .
9+
$ composer create-project dotkernel/dot-admin .
1010
```
1111

1212
## Configuration

bin/clear-config-cache.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,31 @@
44
*
55
* Can also be invoked as `composer clear-config-cache`.
66
*
7-
* @see https://github.com/dotkernel/dot-admin/ for the canonical source repository
8-
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com)
9-
* @license https://github.com/dotkernel/dot-admin/blob/master/LICENSE.md MIT License
7+
* @see https://github.com/zendframework/zend-expressive-skeleton for the canonical source repository
8+
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
9+
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
1010
*/
1111

1212
chdir(__DIR__ . '/../');
13+
1314
require 'vendor/autoload.php';
15+
1416
$config = include 'config/config.php';
15-
if (!isset($config['config_cache_path'])) {
17+
18+
if (! isset($config['config_cache_path'])) {
1619
echo "No configuration cache path found" . PHP_EOL;
1720
exit(0);
1821
}
19-
if (!file_exists($config['config_cache_path'])) {
22+
23+
if (! file_exists($config['config_cache_path'])) {
2024
printf(
2125
"Configured config cache file '%s' not found%s",
2226
$config['config_cache_path'],
2327
PHP_EOL
2428
);
2529
exit(0);
2630
}
31+
2732
if (false === unlink($config['config_cache_path'])) {
2833
printf(
2934
"Error removing config cache file '%s'%s",
@@ -32,6 +37,7 @@
3237
);
3338
exit(1);
3439
}
40+
3541
printf(
3642
"Removed configured config cache file '%s'%s",
3743
$config['config_cache_path'],

composer.json

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,70 @@
99
"email": "tibi@apidemia.com"
1010
}
1111
],
12+
"config": {
13+
"sort-packages": true
14+
},
1215
"require": {
1316
"php": "^7.1",
1417
"roave/security-advisories": "dev-master",
15-
"zendframework/zend-expressive": "^1.0",
16-
"zendframework/zend-expressive-fastroute": "^1.0",
17-
"zendframework/zend-servicemanager": "^3.0",
18-
"zendframework/zend-expressive-twigrenderer": "^1.0",
18+
"zendframework/zend-expressive": "^2.0.2",
19+
"zendframework/zend-expressive-fastroute": "^2.0",
20+
"zendframework/zend-expressive-twigrenderer": "^1.4",
21+
"zendframework/zend-servicemanager": "^3.3.0",
1922
"zendframework/zend-db": "^2.8",
2023
"zendframework/zend-i18n": "^2.7",
2124
"zendframework/zend-i18n-resources": "^2.5",
2225
"zendframework/zend-captcha": "^2.6",
2326
"zendframework/zendservice-recaptcha": "^3.0",
2427
"zendframework/zend-text": "^2.6",
25-
"zendframework/zend-stdlib": "^3.0",
28+
"zendframework/zend-stdlib": "^3.1",
2629
"zendframework/zend-psr7bridge": "^0.2.2",
2730
"zendframework/zend-config": "^3.1",
2831
"zendframework/zend-config-aggregator": "^0.2.0",
29-
"zendframework/zend-component-installer": "^0.6.0 || ~1.0",
32+
"zendframework/zend-component-installer": "^1.0 || ^0.7.0",
3033

31-
"dotkernel/dot-annotated-services": "^1.0",
32-
"dotkernel/dot-authentication-service": "^0.1",
33-
"dotkernel/dot-authentication-web": "^0.1",
34-
"dotkernel/dot-cache": "^1.0",
35-
"dotkernel/dot-controller": "^0.1",
36-
"dotkernel/dot-controller-plugin-flashmessenger": "^0.1",
37-
"dotkernel/dot-controller-plugin-authentication": "^0.1",
38-
"dotkernel/dot-controller-plugin-authorization": "^0.1",
39-
"dotkernel/dot-controller-plugin-forms": "^0.1",
34+
"dotkernel/dot-annotated-services": "^1.1",
35+
"dotkernel/dot-authentication-service": "^0.2",
36+
"dotkernel/dot-authentication-web": "^0.2",
37+
"dotkernel/dot-cache": "^1.1",
38+
"dotkernel/dot-controller": "^0.2",
39+
"dotkernel/dot-controller-plugin-flashmessenger": "^0.2",
40+
"dotkernel/dot-controller-plugin-authentication": "^0.2",
41+
"dotkernel/dot-controller-plugin-authorization": "^0.2",
42+
"dotkernel/dot-controller-plugin-forms": "^0.2",
4043
"dotkernel/dot-controller-plugin-mail": "^0.1",
41-
"dotkernel/dot-controller-plugin-session": "^0.1",
42-
"dotkernel/dot-mapper": "^0.1",
43-
"dotkernel/dot-event": "^0.1",
44-
"dotkernel/dot-filter": "^1.0",
45-
"dotkernel/dot-flashmessenger": "^0.1",
46-
"dotkernel/dot-form": "^1.0",
47-
"dotkernel/dot-helpers": "^0.1",
48-
"dotkernel/dot-hydrator": "^1.0",
49-
"dotkernel/dot-inputfilter": "^1.0",
50-
"dotkernel/dot-log": "^1.0",
44+
"dotkernel/dot-controller-plugin-session": "^0.2",
45+
"dotkernel/dot-mapper": "^0.3",
46+
"dotkernel/dot-event": "^0.2",
47+
"dotkernel/dot-filter": "^1.1",
48+
"dotkernel/dot-flashmessenger": "^0.2",
49+
"dotkernel/dot-form": "^1.1",
50+
"dotkernel/dot-helpers": "^0.2",
51+
"dotkernel/dot-hydrator": "^1.1",
52+
"dotkernel/dot-inputfilter": "^1.1",
53+
"dotkernel/dot-log": "^1.1",
5154
"dotkernel/dot-mail": "^0.1",
52-
"dotkernel/dot-navigation": "^0.1",
53-
"dotkernel/dot-paginator": "^1.0",
54-
"dotkernel/dot-rbac": "^0.1",
55-
"dotkernel/dot-rbac-guard": "^0.1",
56-
"dotkernel/dot-session": "^1.0",
57-
"dotkernel/dot-twigrenderer": "^0.1",
58-
"dotkernel/dot-user": "^0.1",
59-
"dotkernel/dot-validator": "^1.0"
55+
"dotkernel/dot-navigation": "^0.2",
56+
"dotkernel/dot-paginator": "^1.1",
57+
"dotkernel/dot-rbac": "^0.2",
58+
"dotkernel/dot-rbac-guard": "^0.2",
59+
"dotkernel/dot-session": "^2.0",
60+
"dotkernel/dot-twigrenderer": "^0.2",
61+
"dotkernel/dot-user": "^0.2",
62+
"dotkernel/dot-validator": "^1.1"
6063
},
6164
"require-dev": {
62-
"phpunit/phpunit": "^4.8",
63-
"squizlabs/php_codesniffer": "^2.3",
64-
"filp/whoops": "^1.1 || ^2.0",
65-
"mikey179/vfsstream": "^1.6",
65+
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
66+
"squizlabs/php_codesniffer": "^2.8.1",
67+
"zendframework/zend-expressive-tooling": "^0.3.2",
68+
"filp/whoops": "^2.1.7",
6669
"zfcampus/zf-development-mode": "^3.1"
6770
},
6871
"autoload": {
6972
"psr-4": {
70-
"Admin\\App\\": "src/App/",
71-
"Admin\\Admin\\": "src/Admin/",
72-
"Admin\\User\\": "src/User/"
73+
"Admin\\App\\": "src/App/src",
74+
"Admin\\Admin\\": "src/Admin/src",
75+
"Admin\\User\\": "src/User/src"
7376
}
7477
},
7578
"autoload-dev": {
@@ -78,24 +81,28 @@
7881
}
7982
},
8083
"scripts": {
84+
"post-create-project-cmd": [
85+
"@development-enable"
86+
],
8187
"development-disable": "zf-development-mode disable",
8288
"development-enable": "zf-development-mode enable",
8389
"development-status": "zf-development-mode status",
8490
"check": [
85-
"@cs",
91+
"@cs-check",
8692
"@test"
8793
],
8894
"clear-config-cache": "php bin/clear-config-cache.php",
8995
"cs-check": "phpcs",
9096
"cs-fix": "phpcbf",
91-
"serve": "php -S 0.0.0.0:8080 -t public/ public/index.php",
97+
"serve": "php -S 0.0.0.0:8080 -t public public/index.php",
9298
"test": "phpunit --colors=always",
9399
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
94100
"upload-coverage": "coveralls -v"
95101
},
96102
"extra": {
97103
"branch-alias": {
98-
"dev-master": "0.2-dev"
104+
"dev-master": "0.2-dev",
105+
"dev-develop": "0.3-dev"
99106
}
100107
}
101108
}

config/autoload/authentication.global.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
<?php
22

3+
use Admin\Admin\Entity\AdminEntity;
4+
use Admin\Admin\Hydrator\AdminHydrator;
5+
use Dot\User\Service\PasswordCheck;
6+
37
return [
48
'dot_authentication' => [
59
'adapter' => [
610
'type' => 'CallbackCheck',
711
'options' => [
812
'adapter' => 'database',
913

10-
'identity_prototype' => \Admin\Admin\Entity\AdminEntity::class,
11-
'identity_hydrator' => \Dot\Hydrator\ClassMethodsCamelCase::class,
14+
'identity_prototype' => AdminEntity::class,
15+
'identity_hydrator' => AdminHydrator::class,
1216

1317
'table' => 'admin',
1418

1519
'identity_columns' => ['username', 'email'],
1620
'credential_column' => 'password',
1721

18-
'callback_check' => \Dot\User\Service\PasswordCheck::class
22+
'callback_check' => PasswordCheck::class
1923
]
2024
],
2125
'storage' => [

config/autoload/authorization-guards.global.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
use Dot\Rbac\Guard\Guard\GuardInterface;
4+
35
return [
46
'dot_authorization' => [
5-
'protection_policy' => \Dot\Rbac\Guard\Guard\GuardInterface::POLICY_DENY,
7+
'protection_policy' => GuardInterface::POLICY_DENY,
68

79
'event_listeners' => [],
810

@@ -35,7 +37,8 @@
3537
'confirm-account',
3638
'opt-out'
3739
],
38-
'roles' => ['guest'],
40+
// no restriction on these actions because they handle the authentication check
41+
'roles' => ['*'],
3942
]
4043
]
4144
]
@@ -54,7 +57,7 @@
5457
'actions' => ['add', 'edit', 'delete'],
5558
'permissions' => [
5659
'permissions' => ['superuser', 'admin-manager'],
57-
'condition' => \Dot\Rbac\Guard\Guard\GuardInterface::CONDITION_OR,
60+
'condition' => GuardInterface::CONDITION_OR,
5861
],
5962
],
6063
[
@@ -67,7 +70,7 @@
6770
'actions' => [],
6871
'permissions' => [
6972
'permissions' => ['superuser', 'admin'],
70-
'condition' => \Dot\Rbac\Guard\Guard\GuardInterface::CONDITION_OR
73+
'condition' => GuardInterface::CONDITION_OR
7174
]
7275
],
7376
]

config/autoload/cache.global.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<?php
22

3+
use Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory;
4+
use Admin\App\Factory\AnnotationsCacheFactory;
5+
36
return [
47
'annotations_cache_dir' => __DIR__ . '/../../data/cache/annotations',
58

69
'dependencies' => [
710
'factories' => [
811
// used by dot-annotated-services to cache annotations
912
// needs to return a cache instance from Doctrine\Common\Cache
10-
\Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory::CACHE_SERVICE =>
11-
\Admin\App\Factory\AnnotationsCacheFactory::class,
13+
AbstractAnnotatedFactory::CACHE_SERVICE => AnnotationsCacheFactory::class,
1214
]
1315
],
1416
];

config/autoload/controllers.global.php

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
<?php
22

33
use Zend\Expressive\Application;
4-
use Zend\Expressive\Container\ApplicationFactory;
4+
use Zend\Expressive\Container;
5+
use Zend\Expressive\Delegate;
56
use Zend\Expressive\Helper;
7+
use Zend\Expressive\Middleware;
68

79
return [
10+
// Provides application-wide services.
11+
// We recommend using fully-qualified class names whenever possible as
12+
// service names.
813
'dependencies' => [
9-
'factories' => [
10-
Application::class => ApplicationFactory::class,
11-
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
12-
Helper\ServerUrlHelper::class => \Zend\ServiceManager\Factory\InvokableFactory::class,
14+
// Use 'aliases' to alias a service name to another service. The
15+
// key is the alias name, the value is the service to which it points.
16+
'aliases' => [
17+
'Zend\Expressive\Delegate\DefaultDelegate' => Delegate\NotFoundDelegate::class,
1318
],
19+
// Use 'invokables' for constructor-less services, or services that do
20+
// not require arguments to the constructor. Map a service name to the
21+
// class name.
22+
'invokables' => [
23+
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
24+
Helper\ServerUrlHelper::class => Helper\ServerUrlHelper::class,
25+
],
26+
// Use 'factories' for services provided by callbacks/factory classes.
27+
'factories' => [
28+
Application::class => Container\ApplicationFactory::class,
29+
Delegate\NotFoundDelegate::class => Container\NotFoundDelegateFactory::class,
30+
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
31+
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
32+
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
1433

15-
'lazy_services' => [
16-
'proxies_target_dir' => 'data/proxies',
17-
'proxies_namespace' => 'DotProxy',
18-
]
34+
Zend\Stratigility\Middleware\ErrorHandler::class => Container\ErrorHandlerFactory::class,
35+
Middleware\ErrorResponseGenerator::class => Container\ErrorResponseGeneratorFactory::class,
36+
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
37+
],
1938
],
2039
];

0 commit comments

Comments
 (0)