Danyi Dávid 8bca2fbe82 * added doctrine config template
* added loslog template
* removed unused  license files
* added log dir
2020-12-25 21:32:01 +01:00

105 lines
2.9 KiB
Markdown

# 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:
```bash
$ cat ~/.composer/config.json
```
```json
{
"config": {},
"repositories": [
{
"type": "vcs",
"url": "https://gogs.ragnarok.yvan.hu/yvan/mezzio-api-skeleton.git"
}
]
}
```
Start your new API project with composer:
```bash
$ 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:
```bash
$ 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 -S` command that `composer serve` spawns continues running
> as a background process, but on other systems halts when the timeout occurs.
>
> 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:
>
> ```bash
> $ composer run --timeout=86400 serve
> ```
## Application Development Mode Tool
This skeleton comes with [laminas-development-mode](https://github.com/laminas/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!
```bash
$ 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
```bash
$ composer development-disable
```
### Development mode status
```bash
$ 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:
```bash
$ 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.