Download the PHP package maplephp/swiftrender without Composer
On this page you can find all versions of the php package maplephp/swiftrender. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maplephp/swiftrender
More information about maplephp/swiftrender
Files in maplephp/swiftrender
Package swiftrender
Short Description PHP SwiftRender is a pure and highly portable PHP template library.
License Apache-2.0
Homepage https://wazabii.se
Informations about the package swiftrender
SwiftRender
PHP SwiftRender is a pure PHP advanced template library. It offers several advantages for developers who need to create and render templates in PHP applications. Firstly, it can improve performance, as there is no need for an additional language or engine to process the template. This can result in faster rendering times and reduced overhead. Additionally, a pure PHP template library is highly portable, as it can be used in almost any PHP application, regardless of the underlying platform or framework.
PHP SwiftRender offers greater flexibility and control over the rendering process. Developers that knows PHP can structure and design their templates in ways that better suit their specific needs, resulting in more efficient and effective templates.
PHP is a widely-used language, most developers are already familiar with its syntax and conventions. This makes it easier to learn and use a pure PHP template library than an entirely new templating language or engine.
Usage
Initialisation
One time setup to use through the application.
Templating
Index
The file /resources/index.php has already been bounded under the initialisation section above $swift->setIndex("index"). The file looks like this:
View
The file /resources/views/main.php has already been bounded under the initialisation section above $swift->setView("main"). The file looks like this:
Partial
The file /resources/partials/article.php has already been bounded under the initialisation section above $swift->setPartial("article", ...). The file looks like this:
Partial functionality
The partials all arguments will automatically be converted to an object with a lot of extended functionality. Here is some:
Run the template engine
You can run the template engine later in an empty file, emitter or router dispatcher. It all depends on your setup.
Dynamic views
You can also create a dynamic view that will overwrite the current view if called. This is great for e.g. showing a 404 page.
In this example the current view which is /resources/views/main will be replaced with the view /resources/views/httpStatus.php when response status code is (403, 404 e.g.).
Easy DOM manipulation
Advance DOM creation and works great with stuff like the Metadata because you can later in change values and attributes in the controller.