diff --git a/.gitignore b/.gitignore index a0a70c8e73..a9a82082b2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ nbproject .idea .project .settings -vendor +vendor/ composer.phar +config/development.config.php phpunit.xml diff --git a/README.md b/README.md index 4afa7cd236..8de482fcb0 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,23 @@ interfaces. **Note:** The built-in CLI server is *for development only*. +## Development mode + +The skeleton ships with [zf-development-mode](https://github.com/zfcampus/zf-development-mode) +by default, and provides three aliases for consuming the script it ships with: + +```bash +$ composer development-enable # enable development mode +$ composer development-disable # enable development mode +$ composer development-status # whether or not development mode is enabled +``` + +You may provide development-only modules and bootstrap-level configuration in +`config/development.config.php.dist`, and development-only application +configuration in `config/autoload/development.local.php.dist`. Enabling +development mode will copy these files to versions removing the `.dist` suffix, +while disabling development mode will remove those copies. + ## Running Unit Tests To run the supplied skeleton unit tests, you need to do one of the following: diff --git a/composer.json b/composer.json index eb5a337ef4..5125a62072 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "php": "^5.6 || ^7.0", "zendframework/zend-component-installer": "^1.0 || ^0.2 || ^1.0.0-dev@dev", "zendframework/zend-skeleton-installer": "^1.0 || ^0.1.2 || ^1.0.0-dev@dev", - "zendframework/zend-mvc": "^3.0" + "zendframework/zend-mvc": "^3.0", + "zfcampus/zf-development-mode": "^3.0" }, "autoload": { "psr-4": { @@ -102,6 +103,9 @@ ] }, "scripts": { + "development-disable": "zf-development-mode disable", + "development-enable": "zf-development-mode enable", + "development-status": "zf-development-mode status", "serve": "php -S 0.0.0.0:8080 -t public/ public/index.php" } } diff --git a/composer.lock b/composer.lock index b2573456c7..13489c95c1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "16ccc5a155ca7527a65d4aa29d1e4103", - "content-hash": "a1405a0fbb06c02da127788a690083d5", + "hash": "60cce4eab67f50f97ffb881225402af2", + "content-hash": "b54dc57df8c36223af5e033b1a7bb14c", "packages": [ { "name": "container-interop/container-interop", @@ -513,27 +513,30 @@ }, { "name": "zendframework/zend-servicemanager", - "version": "3.0.3", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-servicemanager.git", - "reference": "654eaec084d053c832beca10a53af078afca423e" + "reference": "90b88339a4b937c6bb0055ee04b2567e7e628f25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/654eaec084d053c832beca10a53af078afca423e", - "reference": "654eaec084d053c832beca10a53af078afca423e", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/90b88339a4b937c6bb0055ee04b2567e7e628f25", + "reference": "90b88339a4b937c6bb0055ee04b2567e7e628f25", "shasum": "" }, "require": { "container-interop/container-interop": "~1.0", "php": "^5.5 || ^7.0" }, + "provide": { + "container-interop/container-interop-implementation": "^1.1" + }, "require-dev": { - "ocramius/proxy-manager": "~1.0", + "ocramius/proxy-manager": "^1.0 || ^2.0", "phpbench/phpbench": "^0.10.0", - "phpunit/phpunit": "~4.6", - "squizlabs/php_codesniffer": "^2.0@dev" + "phpunit/phpunit": "^4.6 || ^5.2.10", + "squizlabs/php_codesniffer": "^2.5.1" }, "suggest": { "ocramius/proxy-manager": "ProxyManager 1.* to handle lazy initialization of services", @@ -561,7 +564,7 @@ "servicemanager", "zf" ], - "time": "2016-02-02 14:13:42" + "time": "2016-06-01 16:50:58" }, { "name": "zendframework/zend-skeleton-installer", @@ -772,16 +775,16 @@ }, { "name": "zendframework/zend-view", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-view.git", - "reference": "001336925fec6bb36e8e6d2b2af60da30a9d087e" + "reference": "1516805ed7f04afedbd4600d496437c49847a6cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-view/zipball/001336925fec6bb36e8e6d2b2af60da30a9d087e", - "reference": "001336925fec6bb36e8e6d2b2af60da30a9d087e", + "url": "https://api.github.com/repos/zendframework/zend-view/zipball/1516805ed7f04afedbd4600d496437c49847a6cd", + "reference": "1516805ed7f04afedbd4600d496437c49847a6cd", "shasum": "" }, "require": { @@ -830,11 +833,14 @@ "zendframework/zend-servicemanager": "Zend\\ServiceManager component", "zendframework/zend-uri": "Zend\\Uri component" }, + "bin": [ + "bin/templatemap_generator.php" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "dev-master": "2.8-dev", + "dev-develop": "2.9-dev" } }, "autoload": { @@ -852,7 +858,56 @@ "view", "zf2" ], - "time": "2016-05-12 14:24:52" + "time": "2016-06-21 20:58:34" + }, + { + "name": "zfcampus/zf-development-mode", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/zfcampus/zf-development-mode.git", + "reference": "909413a0a6b45995de804db75b52b44428102dd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zfcampus/zf-development-mode/zipball/909413a0a6b45995de804db75b52b44428102dd4", + "reference": "909413a0a6b45995de804db75b52b44428102dd4", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "phpunit/phpunit": "^5.4", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "bin": [ + "bin/zf-development-mode" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "ZF\\DevelopmentMode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Zend Framework development mode script", + "homepage": "http://github.com/zfcampus/zf-development-mode", + "keywords": [ + "framework", + "zf2" + ], + "time": "2016-06-22 20:39:20" } ], "packages-dev": [], diff --git a/config/application.config.php b/config/application.config.php index 6f989633db..ea34ed59e8 100644 --- a/config/application.config.php +++ b/config/application.config.php @@ -6,12 +6,8 @@ * @see http://framework.zend.com/manual/current/en/tutorials/config.advanced.html#environment-specific-application-configuration */ return [ - // This should be an array of module namespaces used in the application. - 'modules' => [ - 'Zend\Router', - 'Zend\Validator', - 'Application', - ], + // Retrieve list of modules used in this application. + 'modules' => require __DIR__ . '/modules.config.php', // These are various options for the listeners attached to the ModuleManager 'module_listener_options' => [ diff --git a/config/autoload/development.local.php.dist b/config/autoload/development.local.php.dist new file mode 100644 index 0000000000..587f93cec3 --- /dev/null +++ b/config/autoload/development.local.php.dist @@ -0,0 +1,22 @@ + + * $ composer development-enable + * + * + * from the project root to copy this file to development.local.php and enable + * the settings it contains. + * + * You may also create files matching the glob pattern `{,*.}{global,local}-development.php`. + */ + +return [ + 'view_manager' => [ + 'display_exceptions' => true, + ], +]; diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 78145f3012..dd3fa6e83e 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -11,5 +11,5 @@ * credentials from accidentally being committed into version control. */ -return array( -); +return [ +]; diff --git a/config/development.config.php.dist b/config/development.config.php.dist new file mode 100644 index 0000000000..9d56187c17 --- /dev/null +++ b/config/development.config.php.dist @@ -0,0 +1,18 @@ + [ + ], + // Configuration overrides during development mode + 'module_listener_options' => [ + 'config_glob_paths' => ['config/autoload/{,*.}{global,local}-development.php'], + 'config_cache_enabled' => false, + 'module_map_cache_enabled' => false, + ], +]; diff --git a/config/modules.config.php b/config/modules.config.php new file mode 100644 index 0000000000..92ac3cfd4e --- /dev/null +++ b/config/modules.config.php @@ -0,0 +1,17 @@ +run(); +Application::init($appConfig)->run();