* added loslog template * removed unused license files * added log dir
Mezzio API Skeleton
Use to bootstrap an API backend, with database and logging support using:
- los/loslog
- roave/psr-container-doctrine
- tuupola/cors-middleware
Getting Started
You'll have to add the VCS to your composer config.json:
$ cat ~/.composer/config.json
{
"config": {},
"repositories": [
{
"type": "vcs",
"url": "https://gogs.ragnarok.yvan.hu/yvan/mezzio-api-skeleton.git"
}
]
}
Start your new API project with composer:
$ composer create-project yvan/mezzio-api-skeleton --stability=dev <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 run --timeout=0 serve
You can then browse to http://localhost:8080.
Setting a timeout
Composer commands time out after 300 seconds (5 minutes). On Linux-based systems, the
php -Scommand thatcomposer servespawns continues running as a background process, but on other systems halts when the timeout occurs.As such, we recommend running the
servescript using a timeout. This can be done by usingcomposer runto execute theservescript, with a--timeoutoption. When set to0, as in the previous example, no timeout will be used, and it will run until you cancel the process (usually viaCtrl-C). Alternately, you can specify a finite timeout; as an example, the following will extend the timeout to a full day:$ composer run --timeout=86400 serve
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.