Standalone Skeltch templating engine for PHP

Overview

SkeltchGo

SkeltchGo is a standalone version of Glowie Skeltch templating engine for PHP, intented to use from outside the framework.

Requirements

  • PHP version 7.4 or higher
  • Composer version 2.0 or higher

Installation

composer require glowieframework/skeltchgo

Usage

Create an SkeltchGo instance through the static make() method.

use Glowie\SkeltchGo\SkeltchGo;
$skeltch = SkeltchGo::make();

This method returns an instance of ViewRenderer.

The make() method accepts three optional arguments:

  • viewFolder (string) - Folder where the view files are stored, relative to the running script. (Defaults to views)
  • cache (bool) - Enable views caching. Highly recommended in a production environment. (Defaults to true)
  • cacheFolder (string) - View cache folder, relative to the running script. Must have writing permissions. (Defaults to cache)

Rendering views

Views must be .phtml files inside the views folder. Extension is not needed.

From the script

$skeltch->renderView('myView');

From another view

{@view('myView')}

Rendering layouts

Layouts must be .phtml files inside the views folder. Extension is not needed. The second parameter is an optional view file to render within the layout.

From the script

$skeltch->renderLayout('myLayout', 'myView');

From another view

{@layout('myLayout', 'myView')}

To retrieve the internal view content inside the layout use:

{@content}

Passing parameters

There are two ways of passing parameters to the views:

// Globally to all views
$skeltch->view->param1 = 'Lorem ipsum';

// Restricted to a single view
$skeltch->renderView('myView', [
    'param2' => 'Hello world'
]);

Then retrieve it in the view as a property of itself:

{{$this->param1}}

View helpers

Setup a helper method by passing a name and a closure to the helper() method:

$skeltch->helper('sayHello', function($name){
    return "Hello, $name!";
});

And call it in your view file using:

{{$this->sayHello('World')}}

Full documentation

To learn how to use all methods and templating syntax, read Skeltch complete documentation.

Note: some Skeltch methods are restricted to the framework environment and are not available in SkeltchGo. Unavailable methods are: babel, url, route, asset and csrf.

Credits

SkeltchGo and Glowie are currently being developed by Gabriel Silva.

Releases(v1.0.0)
  • v1.0.0(Nov 5, 2021)

    First official SkeltchGo stable release is out!

    What's new:

    • Fixed view parameters inheritance
    • Skeltch support for multiline comments and {@else if} alias

    Contributing: For reporting bugs, asking for new features and collaborating with SkeltchGo development, see our issues page.

    Source code(tar.gz)
    Source code(zip)
Owner
glowie
Glowie is a PHP framework designed to be as light, fast and powerful as possible for developing applications and dynamic websites the easiest way.
glowie
Provides TemplateView and TwoStepView using PHP as the templating language, with support for partials, sections, and helpers.

Aura View This package provides an implementation of the TemplateView and TwoStepView patterns using PHP itself as the templating language. It support

Aura for PHP 81 Jan 12, 2022
A faster, safer templating library for PHP

Brainy Brainy is a replacement for the popular Smarty templating language. It is a fork from the Smarty 3 trunk. Brainy is still very new and it's lik

Box 65 Dec 20, 2021
The Templating component provides all the tools needed to build any kind of template system.

Templating Component The Templating component provides all the tools needed to build any kind of template system. It provides an infrastructure to loa

Symfony 984 Jan 10, 2022
PHP template engine for native PHP templates

FOIL PHP template engine, for PHP templates. Foil brings all the flexibility and power of modern template engines to native PHP templates. Write simpl

Foil PHP 163 Nov 20, 2021
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.

Smarty 3 template engine smarty.net Documentation For documentation see www.smarty.net/docs/en/ Requirements Smarty can be run with PHP 5.2 to PHP 7.4

Smarty PHP Template Engine 1.9k Jan 11, 2022
☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites.

Latte: amazing template engine for PHP Introduction Latte is a template engine for PHP which eases your work and ensures the output is protected again

Nette Foundation 754 Jan 16, 2022
PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages

PHPTAL - Template Attribute Language for PHP Requirements If you want to use the builtin internationalisation system (I18N), the php-gettext extension

PHPTAL 165 Dec 17, 2021
View template engine of PHP extracted from Laravel

Blade 【简体中文】 This is a view templating engine which is extracted from Laravel. It's independent without relying on Laravel's Container or any others.

刘小乐 145 Aug 13, 2021
⚡️ Simple and fastly template engine for PHP

EasyTpl ⚡️ Simple and fastly template engine for PHP Features It's simple, lightweight and fastly. No learning costs, syntax like PHP template It is s

PHPPkg 14 Jan 3, 2022
Twig Template Engine to Phalcon PHP

Twig Template Engine to Phalcon PHP

Vinicius 3 Jun 17, 2021
Twig, the flexible, fast, and secure template language for PHP

Twig, the flexible, fast, and secure template language for PHP Twig is a template language for PHP, released under the new BSD license (code and docum

Twig 7.4k Jan 16, 2022
A Mustache implementation in PHP.

Mustache.php A Mustache implementation in PHP. Usage A quick example: <?php $m = new Mustache_Engine(array('entity_flags' => ENT_QUOTES)); echo $m->re

Justin Hileman 3.1k Jan 13, 2022
Native PHP template system

Plates Plates is a native PHP template system that's fast, easy to use and easy to extend. It's inspired by the excellent Twig template engine and str

The League of Extraordinary Packages 1.3k Jan 7, 2022
Multi target HAML (HAML for PHP, Twig, )

Multi target HAML MtHaml is a PHP implementation of the HAML language which can target multiple languages. Currently supported targets are PHP and Twi

Arnaud Le Blanc 362 Aug 5, 2021
PHP 5.3 Mustache implementation

Phly\Mustache MOVED! This package has moved to phly/phly-mustache, and the package name has changed to phly/phly-mustache. I have updated packagist to

phly 123 Jan 11, 2022
A complete and fully-functional implementation of the Jade template language for PHP

Tale Jade for PHP Finally a fully-functional, complete and clean port of the Jade language to PHP — Abraham Lincoln The Tale Jade Template Engine brin

Talesoft 93 May 4, 2021
TextGenerator is a PHP package that aims to generate automated texts from data.

TextGenerator TextGenerator is a PHP package that aims to generate automated texts from data. Feel free to comment and contribute. Features Text gener

Vincent Brouté 85 Jul 19, 2021
A ready-to-use Model View Controller template in PHP

PHP-MVC-Template A ready-to-use Model View Controller template in PHP Use this repo as a template! (Or clone it) Start to configure your MVC file Afte

Loule | Louis 7 Dec 28, 2021
Derste birlikte hazırladığımız PHP Tema Motoru kaynak kodları

Prototürk Template Engine Prototürk'de sorulan bir soru üzerine videoda birlikte hazırladığımız php ile geliştirilmiş basit bir tema motoru. Geçerli d

Tayfun Erbilen 12 Dec 27, 2021