Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.35 KB

veil.md

File metadata and controls

43 lines (25 loc) · 1.35 KB

Services: Veil

Veil is used as the template engine.

This library will be added to the service container with alias veil when a valid configuration array exists at /config/veil.php.

Example:

use Bayfront\Bones\Application\Utilities\App;

return [
    'base_path' => App::resourcesPath('/views'),
    'file_extension' => '.veil.php'
];

It is recommended to place all your views and template files in the /resources/views directory.

Installation

The Veil service can be installed with the php bones install:service --veil console command.

Installing Veil will perform the following actions:

Add config file

A config file will be added to /config/veil.php (See above example)

Create controller

The /app/Controllers/VeilController controller will be added, which provides an example of how to use Veil.

The veil.data filter is used from within this file to filter the value of the $data array passed to the view.

The response.body filter is used from within this file to filter the value of the response body.

NOTE: Once Veil is installed, create a route which resolves to VeilController:index to see it in action.

Create views

Sample views are created at /resources/views/examples. These are used from within the VeilController controller.