varimax / view
Varimax View Module
dev-main
2023-11-11 03:53 UTC
Requires
- varimax/varimax: dev-master|^2.0
Requires (Dev)
- illuminate/view: ^8.83
- latte/latte: ^2.0
- league/plates: ^3.5
- mustache/mustache: ^2.14
- twig/twig: ^2.6
Suggests
- illuminate/view: Blade ^8.0 view engine
- latte/latte: Latte ~2.11 view engine
- league/plates: Plates ^3.0 view engine
- mustache/mustache: Mustache ^2.* view engine
- twig/twig: Twig ~2.6.x view engine
This package is auto-updated.
Last update: 2024-11-11 06:21:00 UTC
README
Supported Template Engine
- Php (Native php engine template)
- Twig https://twig.symfony.com/doc
- Blade https://laravel.com/docs/8.x/blade
- Latte https://latte.nette.org
- Plates https://platesphp.com
- Mustache https://mustache.github.io
Installation
Step.1
composer require varimax/view
Choice your template engine
composer require latte/latte
composer require league/plates
composer require illuminate/view
composer require twig/twig
composer require mustache/mustache
Step.2
Add the following service config to your config.php
file:
'service' => [ // \VM\View\ViewServiceProvider::Blade() //Blade Template Engine // \VM\View\ViewServiceProvider::Latte() //Latte Template Engine // \VM\View\ViewServiceProvider::Plates() //Plates Template Engine \VM\View\ViewServiceProvider::Twig() //Twig Template Engine // \VM\View\ViewServiceProvider::Mustache() //Mustache Template Engine ]
Step.3
add the following code to your controller
:
$data1 = ['test'=>'test']; $data2 = ['test'=>'test2']; make('view')->render('template.twig', $data1, $data2);
The varimax view service methods
make('view')->config(string $key, mixed $value) make('view')->path(...$paths) make('view')->addPath(string $path) make('view')->getPath() make('view')->getEngine($new = false) make('view')->setEngine($engine) make('view')->assign(...$values) make('view')->render(string $template, array ...$values)