varimax/view

Varimax View Module

Installs: 45

Dependents: 0

Suggesters: 1

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Type:project

dev-main 2023-11-11 03:53 UTC

This package is auto-updated.

Last update: 2024-11-11 06:21:00 UTC


README

Supported Template Engine

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)