Skip to content

Commit

Permalink
Merge pull request #16 from dotkernel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
n3vrax authored Mar 22, 2017
2 parents 6201879 + 0d8c179 commit 253e587
Show file tree
Hide file tree
Showing 90 changed files with 596 additions and 430 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 0.2.0 - 2017-03-22

ZE2 migration

### Changed
* updated factories to PSR11 container and middleware to PSR15
* refactored folder structure to follow modular application design a la ZE2
* programmatic pipeline and routes
* restructured application to match ZE2 structure

### Added
* Nothing

### Deprecated
* Nothing

### Removed
* Nothing

### Fixed
* Nothing


## 0.1.1 - 2017-03-12

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Dotkernel web starter package suitable for admin applications.

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

## Configuration
Expand Down
16 changes: 11 additions & 5 deletions bin/clear-config-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@
*
* Can also be invoked as `composer clear-config-cache`.
*
* @see https://github.com/dotkernel/dot-admin/ for the canonical source repository
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com)
* @license https://github.com/dotkernel/dot-admin/blob/master/LICENSE.md MIT License
* @see https://github.com/zendframework/zend-expressive-skeleton for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
*/

chdir(__DIR__ . '/../');

require 'vendor/autoload.php';

$config = include 'config/config.php';
if (!isset($config['config_cache_path'])) {

if (! isset($config['config_cache_path'])) {
echo "No configuration cache path found" . PHP_EOL;
exit(0);
}
if (!file_exists($config['config_cache_path'])) {

if (! file_exists($config['config_cache_path'])) {
printf(
"Configured config cache file '%s' not found%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);
}

if (false === unlink($config['config_cache_path'])) {
printf(
"Error removing config cache file '%s'%s",
Expand All @@ -32,6 +37,7 @@
);
exit(1);
}

printf(
"Removed configured config cache file '%s'%s",
$config['config_cache_path'],
Expand Down
93 changes: 50 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,70 @@
"email": "[email protected]"
}
],
"config": {
"sort-packages": true
},
"require": {
"php": "^7.1",
"roave/security-advisories": "dev-master",
"zendframework/zend-expressive": "^1.0",
"zendframework/zend-expressive-fastroute": "^1.0",
"zendframework/zend-servicemanager": "^3.0",
"zendframework/zend-expressive-twigrenderer": "^1.0",
"zendframework/zend-expressive": "^2.0.2",
"zendframework/zend-expressive-fastroute": "^2.0",
"zendframework/zend-expressive-twigrenderer": "^1.4",
"zendframework/zend-servicemanager": "^3.3.0",
"zendframework/zend-db": "^2.8",
"zendframework/zend-i18n": "^2.7",
"zendframework/zend-i18n-resources": "^2.5",
"zendframework/zend-captcha": "^2.6",
"zendframework/zendservice-recaptcha": "^3.0",
"zendframework/zend-text": "^2.6",
"zendframework/zend-stdlib": "^3.0",
"zendframework/zend-stdlib": "^3.1",
"zendframework/zend-psr7bridge": "^0.2.2",
"zendframework/zend-config": "^3.1",
"zendframework/zend-config-aggregator": "^0.2.0",
"zendframework/zend-component-installer": "^0.6.0 || ~1.0",
"zendframework/zend-component-installer": "^1.0 || ^0.7.0",

"dotkernel/dot-annotated-services": "^1.0",
"dotkernel/dot-authentication-service": "^0.1",
"dotkernel/dot-authentication-web": "^0.1",
"dotkernel/dot-cache": "^1.0",
"dotkernel/dot-controller": "^0.1",
"dotkernel/dot-controller-plugin-flashmessenger": "^0.1",
"dotkernel/dot-controller-plugin-authentication": "^0.1",
"dotkernel/dot-controller-plugin-authorization": "^0.1",
"dotkernel/dot-controller-plugin-forms": "^0.1",
"dotkernel/dot-annotated-services": "^1.1",
"dotkernel/dot-authentication-service": "^0.2",
"dotkernel/dot-authentication-web": "^0.2",
"dotkernel/dot-cache": "^1.1",
"dotkernel/dot-controller": "^0.2",
"dotkernel/dot-controller-plugin-flashmessenger": "^0.2",
"dotkernel/dot-controller-plugin-authentication": "^0.2",
"dotkernel/dot-controller-plugin-authorization": "^0.2",
"dotkernel/dot-controller-plugin-forms": "^0.2",
"dotkernel/dot-controller-plugin-mail": "^0.1",
"dotkernel/dot-controller-plugin-session": "^0.1",
"dotkernel/dot-mapper": "^0.1",
"dotkernel/dot-event": "^0.1",
"dotkernel/dot-filter": "^1.0",
"dotkernel/dot-flashmessenger": "^0.1",
"dotkernel/dot-form": "^1.0",
"dotkernel/dot-helpers": "^0.1",
"dotkernel/dot-hydrator": "^1.0",
"dotkernel/dot-inputfilter": "^1.0",
"dotkernel/dot-log": "^1.0",
"dotkernel/dot-controller-plugin-session": "^0.2",
"dotkernel/dot-mapper": "^0.3",
"dotkernel/dot-event": "^0.2",
"dotkernel/dot-filter": "^1.1",
"dotkernel/dot-flashmessenger": "^0.2",
"dotkernel/dot-form": "^1.1",
"dotkernel/dot-helpers": "^0.2",
"dotkernel/dot-hydrator": "^1.1",
"dotkernel/dot-inputfilter": "^1.1",
"dotkernel/dot-log": "^1.1",
"dotkernel/dot-mail": "^0.1",
"dotkernel/dot-navigation": "^0.1",
"dotkernel/dot-paginator": "^1.0",
"dotkernel/dot-rbac": "^0.1",
"dotkernel/dot-rbac-guard": "^0.1",
"dotkernel/dot-session": "^1.0",
"dotkernel/dot-twigrenderer": "^0.1",
"dotkernel/dot-user": "^0.1",
"dotkernel/dot-validator": "^1.0"
"dotkernel/dot-navigation": "^0.2",
"dotkernel/dot-paginator": "^1.1",
"dotkernel/dot-rbac": "^0.2",
"dotkernel/dot-rbac-guard": "^0.2",
"dotkernel/dot-session": "^2.0",
"dotkernel/dot-twigrenderer": "^0.2",
"dotkernel/dot-user": "^0.2",
"dotkernel/dot-validator": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"squizlabs/php_codesniffer": "^2.3",
"filp/whoops": "^1.1 || ^2.0",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
"squizlabs/php_codesniffer": "^2.8.1",
"zendframework/zend-expressive-tooling": "^0.3.2",
"filp/whoops": "^2.1.7",
"zfcampus/zf-development-mode": "^3.1"
},
"autoload": {
"psr-4": {
"Admin\\App\\": "src/App/",
"Admin\\Admin\\": "src/Admin/",
"Admin\\User\\": "src/User/"
"Admin\\App\\": "src/App/src",
"Admin\\Admin\\": "src/Admin/src",
"Admin\\User\\": "src/User/src"
}
},
"autoload-dev": {
Expand All @@ -78,24 +81,28 @@
}
},
"scripts": {
"post-create-project-cmd": [
"@development-enable"
],
"development-disable": "zf-development-mode disable",
"development-enable": "zf-development-mode enable",
"development-status": "zf-development-mode status",
"check": [
"@cs",
"@cs-check",
"@test"
],
"clear-config-cache": "php bin/clear-config-cache.php",
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8080 -t public/ public/index.php",
"serve": "php -S 0.0.0.0:8080 -t public public/index.php",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"upload-coverage": "coveralls -v"
},
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"
"dev-master": "0.2-dev",
"dev-develop": "0.3-dev"
}
}
}
10 changes: 7 additions & 3 deletions config/autoload/authentication.global.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php

use Admin\Admin\Entity\AdminEntity;
use Admin\Admin\Hydrator\AdminHydrator;
use Dot\User\Service\PasswordCheck;

return [
'dot_authentication' => [
'adapter' => [
'type' => 'CallbackCheck',
'options' => [
'adapter' => 'database',

'identity_prototype' => \Admin\Admin\Entity\AdminEntity::class,
'identity_hydrator' => \Dot\Hydrator\ClassMethodsCamelCase::class,
'identity_prototype' => AdminEntity::class,
'identity_hydrator' => AdminHydrator::class,

'table' => 'admin',

'identity_columns' => ['username', 'email'],
'credential_column' => 'password',

'callback_check' => \Dot\User\Service\PasswordCheck::class
'callback_check' => PasswordCheck::class
]
],
'storage' => [
Expand Down
11 changes: 7 additions & 4 deletions config/autoload/authorization-guards.global.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

use Dot\Rbac\Guard\Guard\GuardInterface;

return [
'dot_authorization' => [
'protection_policy' => \Dot\Rbac\Guard\Guard\GuardInterface::POLICY_DENY,
'protection_policy' => GuardInterface::POLICY_DENY,

'event_listeners' => [],

Expand Down Expand Up @@ -35,7 +37,8 @@
'confirm-account',
'opt-out'
],
'roles' => ['guest'],
// no restriction on these actions because they handle the authentication check
'roles' => ['*'],
]
]
]
Expand All @@ -54,7 +57,7 @@
'actions' => ['add', 'edit', 'delete'],
'permissions' => [
'permissions' => ['superuser', 'admin-manager'],
'condition' => \Dot\Rbac\Guard\Guard\GuardInterface::CONDITION_OR,
'condition' => GuardInterface::CONDITION_OR,
],
],
[
Expand All @@ -67,7 +70,7 @@
'actions' => [],
'permissions' => [
'permissions' => ['superuser', 'admin'],
'condition' => \Dot\Rbac\Guard\Guard\GuardInterface::CONDITION_OR
'condition' => GuardInterface::CONDITION_OR
]
],
]
Expand Down
6 changes: 4 additions & 2 deletions config/autoload/cache.global.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php

use Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory;
use Admin\App\Factory\AnnotationsCacheFactory;

return [
'annotations_cache_dir' => __DIR__ . '/../../data/cache/annotations',

'dependencies' => [
'factories' => [
// used by dot-annotated-services to cache annotations
// needs to return a cache instance from Doctrine\Common\Cache
\Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory::CACHE_SERVICE =>
\Admin\App\Factory\AnnotationsCacheFactory::class,
AbstractAnnotatedFactory::CACHE_SERVICE => AnnotationsCacheFactory::class,
]
],
];
11 changes: 0 additions & 11 deletions config/autoload/controllers.global.php

This file was deleted.

37 changes: 28 additions & 9 deletions config/autoload/dependencies.global.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
<?php

use Zend\Expressive\Application;
use Zend\Expressive\Container\ApplicationFactory;
use Zend\Expressive\Container;
use Zend\Expressive\Delegate;
use Zend\Expressive\Helper;
use Zend\Expressive\Middleware;

return [
// Provides application-wide services.
// We recommend using fully-qualified class names whenever possible as
// service names.
'dependencies' => [
'factories' => [
Application::class => ApplicationFactory::class,
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
Helper\ServerUrlHelper::class => \Zend\ServiceManager\Factory\InvokableFactory::class,
// Use 'aliases' to alias a service name to another service. The
// key is the alias name, the value is the service to which it points.
'aliases' => [
'Zend\Expressive\Delegate\DefaultDelegate' => Delegate\NotFoundDelegate::class,
],
// Use 'invokables' for constructor-less services, or services that do
// not require arguments to the constructor. Map a service name to the
// class name.
'invokables' => [
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
Helper\ServerUrlHelper::class => Helper\ServerUrlHelper::class,
],
// Use 'factories' for services provided by callbacks/factory classes.
'factories' => [
Application::class => Container\ApplicationFactory::class,
Delegate\NotFoundDelegate::class => Container\NotFoundDelegateFactory::class,
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,

'lazy_services' => [
'proxies_target_dir' => 'data/proxies',
'proxies_namespace' => 'DotProxy',
]
Zend\Stratigility\Middleware\ErrorHandler::class => Container\ErrorHandlerFactory::class,
Middleware\ErrorResponseGenerator::class => Container\ErrorResponseGeneratorFactory::class,
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
],
],
];
Loading

0 comments on commit 253e587

Please sign in to comment.