Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 043401a

Browse files
committed
[#122] Documented template factories
1 parent f1400b9 commit 043401a

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

doc/book/container/factories.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,97 @@ It consumes the following `config` structure:
203203

204204
The `editor` value must be a known editor name (see the Whoops documentation for
205205
pre-configured editor types), a callable, or a service name to use.
206+
207+
## PlatesFactory
208+
209+
- **Provides**: `Zend\Expressive\Template\Plates`
210+
- **FactoryName**: `Zend\Expressive\Container\Template\PlatesFactory`
211+
- **Suggested Name**: `Zend\Expressive\Template\TemplateInterface`
212+
- **Requires**: no additional services are required.
213+
- **Optional**:
214+
- `config`, an array or `ArrayAccess` instance. This will be used to further
215+
configure the `Plates` instance, specifically with the filename extension
216+
to use, and paths to inject.
217+
218+
It consumes the following `config` structure:
219+
220+
```php
221+
'templates' => [
222+
'extension' => 'file extension used by templates; defaults to html',
223+
'paths' => [
224+
// namespace / path pairs
225+
//
226+
// Numeric namespaces imply the default/main namespace. Paths may be
227+
// strings or arrays of string paths to associate with the namespace.
228+
],
229+
]
230+
```
231+
232+
One note: Due to a limitation in the Plates engine, you can only map one path
233+
per namespace when using Plates.
234+
235+
## TwigFactory
236+
237+
- **Provides**: `Zend\Expressive\Template\Twig`
238+
- **FactoryName**: `Zend\Expressive\Container\Template\TwigFactory`
239+
- **Suggested Name**: `Zend\Expressive\Template\TemplateInterface`
240+
- **Requires**: no additional services are required.
241+
- **Optional**:
242+
- `Zend\Expressive\Router\RouterInterface`; if found, it will be used to
243+
seed a `Zend\Expressive\Template\Twig\TwigExtension` instance for purposes
244+
of rendering application URLs.
245+
- `config`, an array or `ArrayAccess` instance. This will be used to further
246+
configure the `Twig` instance, specifically with the filename extension,
247+
paths to assets (and default asset version to use), and template paths to
248+
inject.
249+
250+
It consumes the following `config` structure:
251+
252+
```php
253+
'debug' => boolean,
254+
'templates' => [
255+
'cache_dir' => 'path to cached templates',
256+
'assets_url' => 'base URL for assets',
257+
'assets_version' => 'base version for assets',
258+
'extension' => 'file extension used by templates; defaults to html',
259+
'paths' => [
260+
// namespace / path pairs
261+
//
262+
// Numeric namespaces imply the default/main namespace. Paths may be
263+
// strings or arrays of string paths to associate with the namespace.
264+
],
265+
]
266+
```
267+
268+
Whe `debug` is true, it disables caching, enables debug mode, enables strict
269+
variables, and enables auto reloading. The `assets_*` values are used to seed
270+
the `TwigExtension` instance (assuming the router was found).
271+
272+
## ZendViewFactory
273+
274+
- **Provides**: `Zend\Expressive\Template\ZendView`
275+
- **FactoryName**: `Zend\Expressive\Container\Template\ZendViewFactory`
276+
- **Suggested Name**: `Zend\Expressive\Template\TemplateInterface`
277+
- **Requires**: no additional services are required.
278+
- **Optional**:
279+
- `config`, an array or `ArrayAccess` instance. This will be used to further
280+
configure the `ZendView` instance, specifically with the layout template
281+
name, entries for a `TemplateMapResolver`, and and template paths to
282+
inject.
283+
284+
It consumes the following `config` structure:
285+
286+
```php
287+
'templates' => [
288+
'layout' => 'name of layout view to use, if any',
289+
'map' => [
290+
// template => filename pairs
291+
],
292+
'paths' => [
293+
// namespace / path pairs
294+
//
295+
// Numeric namespaces imply the default/main namespace. Paths may be
296+
// strings or arrays of string paths to associate with the namespace.
297+
],
298+
]
299+
```

doc/book/template/intro.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ We currently support:
2828
- [Plates](plates.md)
2929
- [Twig](twig.md)
3030
- [zend-view](zend-view.md)
31+
32+
Each has an associated container factory; details are found in the
33+
[factories documentation](../container/factories.md).

0 commit comments

Comments
 (0)