skar / mezzio-skeleton
Laminas mezzio skeleton. Begin developing PSR-15 middleware applications in seconds!
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0
- composer/package-versions-deprecated: ^1.10.99
- laminas/laminas-component-installer: ^2.6 || ^3.0
- laminas/laminas-config-aggregator: ^1.6
- laminas/laminas-diactoros: ^3.0.0
- laminas/laminas-stdlib: ^3.6
- mezzio/mezzio: ^3.7
- mezzio/mezzio-helpers: ^5.7
Requires (Dev)
- chubbyphp/chubbyphp-laminas-config: ^1.3.0
- composer/composer: ^2.7.7
- elie29/zend-phpdi-config: ^9.0.1
- filp/whoops: ^2.15.4
- jsoumelidis/zend-sf-di-config: ^0.5.1
- laminas/laminas-coding-standard: ~2.5.0
- laminas/laminas-development-mode: ^3.12.0
- laminas/laminas-servicemanager: ^3.22.1
- mezzio/mezzio-fastroute: ^3.11.0
- mezzio/mezzio-laminasrouter: ^3.9.0
- mezzio/mezzio-laminasviewrenderer: ^2.15.1
- mezzio/mezzio-platesrenderer: ^2.10.0
- mezzio/mezzio-tooling: ^2.9
- mikey179/vfsstream: ^1.6.11
- phpunit/phpunit: ^10.5.28
- psalm/plugin-phpunit: ^0.19.0
- roave/security-advisories: dev-master
- vimeo/psalm: ^5.25
This package is auto-updated.
Last update: 2024-10-31 00:18:47 UTC
README
Begin developing PSR-15 middleware applications in seconds!
mezzio builds on laminas-stratigility to provide a minimalist PSR-15 middleware framework for PHP with routing, DI container, optional templating, and optional error handling capabilities.
This installer will setup a skeleton application based on mezzio by choosing optional packages based on user input.
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.
Getting Started
Start your new Mezzio project with composer:
$ composer create-project mezzio/mezzio-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:
$ composer serve
You can then browse to http://localhost:8080.
Installing alternative packages
There is a feature to install alternative packages: Instead of entering one of the selection you can actually type the package name and version.
Which template engine do you want to use? [1] Plates [2] zend-view installs zend-servicemanager [n] None of the above Make your selection or type a composer package name and version (n): infw/pug:0.1 - Searching for infw/pug:0.1 - Adding package infw/pug (0.1)
That feature allows you to install any alternative package you want. It has its limitations though:
- The alternative package must follow this format
namespace/package:1.0
. It needs the correct version. - Templates are not copied, but the ConfigProvider can be configured in such way that it uses the default templates directly from the package itself.
- This doesn't work for containers as the container.php file needs to be copied.
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
.
- Be sure to work with the latest version of composer by running
composer self-update
. - Try clearing Composer's cache by running
composer clear-cache
.
If neither of the above help, you might face more serious issues:
- Info about the zlib_decode error.
- Info and solutions for composer degraded mode.
Application Development Mode Tool
This skeleton comes with laminas-development-mode. It provides a composer script to allow you to enable and disable development mode.
To enable development mode
Note: Do NOT run development mode on your production server!
$ 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.
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.
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:
$ 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.
Skeleton Development
This section applies only if you cloned this repo with git clone
, not when you
installed mezzio with composer create-project ...
.
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.
$ composer update --no-scripts
$ composer test
Please note that the installer tests remove installed config files and templates before and after running the tests.
Before contributing read the contributing guide.