Skip to content

Commit 1ac67cd

Browse files
authored
Merge pull request #17 from dotkernel/develop
Develop
2 parents 644cb6f + 1641be2 commit 1ac67cd

File tree

101 files changed

+2363
-992
lines changed

Some content is hidden

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

101 files changed

+2363
-992
lines changed

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
## 0.2.0 - 2017-03-22
2+
3+
ZE2 migration
4+
5+
### Changed
6+
* new design
7+
* updated to PSR11 container
8+
* updated to PSR15 middleware
9+
* refactored project structure to follow modular design promoted by ZE2
10+
* programmatic routes and pipeline
11+
12+
### Added
13+
* Nothing
14+
15+
### Deprecated
16+
* Nothing
17+
18+
### Removed
19+
* Nothing
20+
21+
### Fixed
22+
* Nothing
23+
24+
125
## 0.1.2 - 2017-03-12
226

327
### Added

README.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ Dotkernel web starter package suitable for frontend 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-frontend .
9+
$ composer create-project dotkernel/dot-frontend .
1010
```
1111

1212
## Configuration
1313

1414
* import the database schema, if you are using mysql, found in `data/dot-frontend.sql`
15-
* remove the `.dist` extension of the files `local.php.dist` and `errorhandler.local.php.dist` located in `config/autoload`
15+
* remove the `.dist` extension of the files `local.php.dist` located in `config/autoload`
1616
* edit `local.php` according to your dev machine. Fill in the `database` configuration and a smtp credentials if you want your application to send mails on registration etc.
1717
* get a recaptcha key pair and configure the `local.php` with them
18-
* run the following command in your project root dir
18+
* if you use the create-project command, after installing, the project will go into development mode automatically
19+
* you can also toggle development mode by using the composer commands
1920
```bash
2021
$ composer development-enable
22+
$ composer development-disable
2123
```
2224
This will enable dev mode having debug flag true and configuration caching off. It also make sure that any previously config cache is cleared.
2325

@@ -34,3 +36,14 @@ If you still get exceptions or errors regarding some missing services, try runni
3436
```bash
3537
$ composer clear-config-cache
3638
```
39+
40+
**NOTE**
41+
If you get errors when running composer commands like development-enable or clear-config-cache related to parsing errors and strict types
42+
it is probably because you don't have the PHP CLI version > 7.1 installed
43+
44+
If you cannot use these commands(for example if you cannot upgrade PHP globally) you can setup/clean the project by hand as described below or if you have a locally installed PHP 7.1 version installed you can use that
45+
* enable development mode by renaming the files `config/development.config.php.dist` and `config/autoload/development.local.php.dist` to removed the `.dist` extension
46+
* disable dev mode by reverting the above procedure
47+
* run `bin/clear-config-cache.php` using the proper PHP version if accessible OR
48+
* manually clear cached data from `data/cache` directory and optionally `data/proxies`
49+

bin/clear-config-cache.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/**
43
* Script for clearing the configuration cache.
54
*
@@ -9,21 +8,27 @@
98
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
109
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
1110
*/
11+
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

+48-41
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
"email": "[email protected]"
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",
@@ -26,49 +29,49 @@
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-
"Frontend\\App\\": "src/App/",
71-
"Frontend\\User\\": "src/User"
73+
"Frontend\\App\\": "src/App/src",
74+
"Frontend\\User\\": "src/User/src"
7275
}
7376
},
7477
"autoload-dev": {
@@ -77,24 +80,28 @@
7780
}
7881
},
7982
"scripts": {
83+
"post-create-project-cmd": [
84+
"@development-enable"
85+
],
8086
"development-disable": "zf-development-mode disable",
8187
"development-enable": "zf-development-mode enable",
8288
"development-status": "zf-development-mode status",
8389
"check": [
84-
"@cs",
90+
"@cs-check",
8591
"@test"
8692
],
8793
"clear-config-cache": "php bin/clear-config-cache.php",
8894
"cs-check": "phpcs",
8995
"cs-fix": "phpcbf",
90-
"serve": "php -S 0.0.0.0:8080 -t public/ public/index.php",
96+
"serve": "php -S 0.0.0.0:8080 -t public public/index.php",
9197
"test": "phpunit --colors=always",
9298
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
9399
"upload-coverage": "coveralls -v"
94100
},
95101
"extra": {
96102
"branch-alias": {
97-
"dev-master": "0.2-dev"
103+
"dev-master": "0.2-dev",
104+
"dev-develop": "0.3-dev"
98105
}
99106
}
100107
}

config/autoload/authentication.global.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
<?php
22

3+
use Frontend\User\Entity\UserEntity;
4+
use Dot\Hydrator\ClassMethodsCamelCase;
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' => \Frontend\User\Entity\UserEntity::class,
11-
'identity_hydrator' => \Dot\Hydrator\ClassMethodsCamelCase::class,
14+
'identity_prototype' => UserEntity::class,
15+
'identity_hydrator' => ClassMethodsCamelCase::class,
1216

1317
'table' => 'user',
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

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

3-
return [
3+
use Dot\Rbac\Guard\Guard\GuardInterface;
44

5+
return [
56
'dot_authorization' => [
6-
'protection_policy' => \Dot\Rbac\Guard\Guard\GuardInterface::POLICY_ALLOW,
7+
'protection_policy' => GuardInterface::POLICY_ALLOW,
78

89
'event_listeners' => [],
910

@@ -20,7 +21,20 @@
2021
'rules' => [
2122
[
2223
'route' => 'user',
23-
'actions' => ['change-password', 'account'],
24+
'actions' => [
25+
'register',
26+
'reset-password',
27+
'forgot-password',
28+
'confirm-account',
29+
'opt-out',
30+
'pending-activation',
31+
'resend-activation'
32+
],
33+
'permissions' => ['*']
34+
],
35+
[
36+
'route' => 'user',
37+
'actions' => [],
2438
'permissions' => ['authenticated']
2539
],
2640
[

config/autoload/cache.global.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<?php
22

3+
use Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory;
4+
use Frontend\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-
\Frontend\App\Factory\AnnotationsCacheFactory::class,
13+
AbstractAnnotatedFactory::CACHE_SERVICE => AnnotationsCacheFactory::class,
1214
]
1315
],
1416
];

config/autoload/controllers.global.php

-9
This file was deleted.
+28-9
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)