2017 © Pedro Peláez
 

project zend-expressive-skeleton

Zend expressive skeleton. Begin developing PSR-15 middleware applications in seconds!

image

zendframework/zend-expressive-skeleton

Zend expressive skeleton. Begin developing PSR-15 middleware applications in seconds!

  • Friday, June 22, 2018
  • by zendframework
  • Repository
  • 55 Watchers
  • 123 Stars
  • 33,892 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 96 Forks
  • 4 Open issues
  • 48 Versions
  • 7 % Grown

The README.md

Expressive Skeleton and Installer

Repository abandoned 2019-12-31

This repository has moved to mezzio/mezzio-skeleton., (*1)

Build Status Coverage Status, (*2)

Begin developing PSR-15 middleware applications in seconds!, (*3)

zend-expressive builds on zend-stratigility to provide a minimalist PSR-15 middleware framework for PHP with routing, DI container, optional templating, and optional error handling capabilities., (*4)

This installer will setup a skeleton application based on zend-expressive by choosing optional packages based on user input as demonstrated in the following screenshot:, (*5)

screenshot-installer, (*6)

The user selected packages are saved into composer.json so that everyone else working on the project have the same packages installed. Configuration files and templates are prepared for first use. The installer command is removed from composer.json after setup succeeded, and all installer related files are removed., (*7)

Getting Started

Start your new Expressive project with composer:, (*8)

$ composer create-project zendframework/zend-expressive-skeleton <project-path>

After choosing and installing the packages you want, go to the <project-path> and start PHP's built-in web server to verify installation:, (*9)

$ composer run --timeout=0 serve

You can then browse to http://localhost:8080., (*10)

Linux users

On PHP versions prior to 7.1.14 and 7.2.2, this command might not work as expected due to a bug in PHP that only affects linux environments. In such scenarios, you will need to start the built-in web server yourself, using the following command:, (*11)

$ php -S 0.0.0.0:8080 -t public/ public/index.php
  

Setting a timeout

Composer commands time out after 300 seconds (5 minutes). On Linux-based systems, the php -S command that composer serve spawns continues running as a background process, but on other systems halts when the timeout occurs., (*12)

As such, we recommend running the serve script using a timeout. This can be done by using composer run to execute the serve script, with a --timeout option. When set to 0, as in the previous example, no timeout will be used, and it will run until you cancel the process (usually via Ctrl-C). Alternately, you can specify a finite timeout; as an example, the following will extend the timeout to a full day:, (*13)

$ composer run --timeout=86400 serve
  

Troubleshooting

If the installer fails during the composer create-project phase, please go through the following list before opening a new issue. Most issues we have seen so far can be solved by self-update and clear-cache., (*14)

  1. Be sure to work with the latest version of composer by running composer self-update.
  2. Try clearing Composer's cache by running composer clear-cache.

If neither of the above help, you might face more serious issues:, (*15)

Application Development Mode Tool

This skeleton comes with zf-development-mode. It provides a composer script to allow you to enable and disable development mode., (*16)

To enable development mode

Note: Do NOT run development mode on your production server!, (*17)

$ composer development-enable

Note: Enabling development mode will also clear your configuration cache, to allow safely updating dependencies and ensuring any new configuration is picked up by your application., (*18)

To disable development mode

$ composer development-disable

Development mode status

$ composer development-status

Configuration caching

By default, the skeleton will create a configuration cache in data/config-cache.php. When in development mode, the configuration cache is disabled, and switching in and out of development mode will remove the configuration cache., (*19)

You may need to clear the configuration cache in production when deploying if you deploy to the same directory. You may do so using the following:, (*20)

$ composer clear-config-cache

You may also change the location of the configuration cache itself by editing the config/config.php file and changing the config_cache_path entry of the local $cacheConfig variable., (*21)

Skeleton Development

This section applies only if you cloned this repo with git clone, not when you installed expressive with composer create-project ...., (*22)

If you want to run tests against the installer, you need to clone this repo and setup all dependencies with composer. Make sure you prevent composer running scripts with --no-scripts, otherwise it will remove the installer and all tests., (*23)

$ composer update --no-scripts
$ composer test

Please note that the installer tests remove installed config files and templates before and after running the tests., (*24)

Before contributing read the contributing guide., (*25)

The Versions