Skip to content

Phtml

AutomationPHP VersionPackagist DownloadsPayPalSponsors via GitHub

A powerful PHP template engine designed to deliver high-performance, extensibility, and security.

Warning

This project is not finished yet, work in progress.

Installation

You can install the package via composer:

composer require ghostwriter/phtml

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

useGhostwriter\Phtml\Phtml;
$phtml = Phtml::new('path/to/templates', 'path/to/cache');
$phtml->registerNamespace('html', 'path/to/templates/html');
// File: path/to/templates/html/element/paragraph.phtml// Content: <p>{{ $message }}</p>// "html" is the namespace.// "element" is the directory name inside the namespace.// "paragraph" is the template filename inside the directory, without the ".phtml" extension.$html = $phtml->render('html::element.paragraph',['message' => '#BlackLivesMatter']);
echo$html; // <p>#BlackLivesMatter</p>

Advanced Usage

useGhostwriter\Phtml\Cache\PhtmlCache;
useGhostwriter\Phtml\Compiler\PhtmlCompiler;
useGhostwriter\Phtml\Engine\PhtmlEngine;
useGhostwriter\Phtml\Loader\PhtmlLoader;
useGhostwriter\Phtml\Renderer\PhtmlRenderer;
$cache = PhtmlCache::new('path/to/cache');
$loader = PhtmlLoader::new('path/to/templates');
$compiler = PhtmlCompiler::new($cache, $loader);
$engine = PhtmlEngine::new($compiler);
$renderer = PhtmlRenderer::new($engine);
$result = $renderer->render(template: 'alert', context: ['message' => '#BlackLivesMatter']);

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.

About

[WIP] A powerful PHP template engine designed to deliver high-performance, extensibility, and security

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

Generated from ghostwriter/wip