Skip to content

marko-php/marko-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marko/view

View and template rendering interface -- defines how controllers render templates, not which engine is used.

Installation

composer require marko/view

Note: You also need a view driver. Install marko/view-latte for Latte template support or marko/view-twig for Twig template support.

Quick Example

use Marko\Routing\Attributes\Get;
use Marko\Routing\Http\Response;
use Marko\View\ViewInterface;

class PostController
{
    public function __construct(
        private readonly ViewInterface $view,
    ) {}

    #[Get('/posts/{id}')]
    public function show(int $id): Response
    {
        return $this->view->render('blog::post/show', [
            'post' => $this->findPost($id),
        ]);
    }
}

Documentation

Full usage, API reference, and examples: marko/view

About

[READ-ONLY] Marko Framework View - Templating interfaces and contracts. Issues and PRs at https://github.com/marko-php/marko

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages