Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ nbproject
.idea
.project
.settings
vendor
vendor/
composer.phar
config/development.config.php
phpunit.xml
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/enable/disable

$ 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:
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
89 changes: 72 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions config/application.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
22 changes: 22 additions & 0 deletions config/autoload/development.local.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Local Configuration Override for DEVELOPMENT MODE.
*
* This configuration override file is for providing configuration to use while
* in development mode. Run:
*
* <code>
* $ composer development-enable
* </code>
*
* 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,
],
];
4 changes: 2 additions & 2 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
* credentials from accidentally being committed into version control.
*/

return array(
);
return [
];
18 changes: 18 additions & 0 deletions config/development.config.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

return [
// Additional modules to include when in development mode
'modules' => [
],
// 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,
],
];
17 changes: 17 additions & 0 deletions config/modules.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* List of enabled modules for this application.
*
* This should be an array of module namespaces used in the application.
*/
return [
'Zend\Router',
'Zend\Validator',
'Application',
];
9 changes: 8 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Zend\Mvc\Application;
use Zend\Stdlib\ArrayUtils;

/**
* This makes our life easier when dealing with paths. Everything is relative
Expand Down Expand Up @@ -29,5 +30,11 @@
);
}

// Retrieve configuration
$appConfig = require __DIR__ . '/../config/application.config.php';
if (file_exists(__DIR__ . '/../config/development.config.php')) {
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file_exists and require are checking for different files

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @alextech - fixing now!

}

// Run the application!
Application::init(require __DIR__ . '/../config/application.config.php')->run();
Application::init($appConfig)->run();