Skip to content

Declarative Templating Engine for PHP

License

Notifications You must be signed in to change notification settings

elephox-dev/templar

Repository files navigation

Templar

Templar is a declarative templating engine for PHP. It was inspired by the approach used by Flutter, written in Dart.

Basic Usage

class Homepage extends BuildWidget {
    public function build(): Widget {
        return new FullscreenDocument(
            head: new Head(),
            body: new FullscreenBody(
                child: new Center(
                    new Text('Hello, world!'),
                ),
            ),
        );
    }
}

$templar = new Templar();
if (str_ends_with($_SERVER['REQUEST_URI'], '.css')) {
    header('Content-Type: text/css');

    echo $templar->renderStyle(new Homepage());
} else {
    header('Content-Type: text/html');

    echo $templar->render(new Homepage());
}

About

Declarative Templating Engine for PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages