A Flexible Template Engine backed by an Object Oriented Programming Framework.
Originally developed with the sole purpose of maintaing readible code when including dynamic data (possibly from a database) in HTML pages, the Phelx Template Engine allows for the seamless output of server side data without the clutter scripts and additional code from the server-side language.
First built to support PHP as the server-side language, the Phlex Template Engine was integrated into a custom PHP framework which made the web development process based in it's entirety on Object Oriented Programming with tightly typed variables and functions.
When data needs to be extracted from external sources before it can be displayed to the used, additional pieces of code must be included with the HTML which can become difficult to read and understand over time especially with applications which are almost compltely dynamic.
Also, there was the issue of unstructured data which would require reviewing the functionality of methods and libraries before any implementation can occur. Making the development process even more time consuming, even with the use of Plug & Play frameworks (download once use anytime).
Even with comprehensive frameworks such as Laravel were available at the time with which the Template Engine could have been integrated, it's configuration required the use of Composer which in itself required an active internet connection, not readibly available and with the network behind a proxy and with economic restrictions, outgoing connections were restricted.
Create a template structure similar to Python which requires less code but with equal functionality.
Make template structure as close to other programming languages a possible so as to maintain familiarity and ease of use.
Creating a parser for a language with structure similar to Python as it relies on structured spacing and indentation which made the process a bit more complex.
With a python like template structure, the issue with searching for a specific block of code over hundreds of lines. Blocks were not easily identifiable.
Preventing the use of server-side code in templates with the aim of maintaining a Model-View-Controller (MVC) project structure. Seperating design from logic.
Adding support for the template language into existing editors.
For improved usability on the framework side, I decide to make use of namespaces (PHP) to allow for faster referencing of classes and name collision avoidance among classes. This proved challengeing as it was my first time working with this concept, but after many hours of tutorials and best practice articles, I managed to completely integrate namesaces into the framework.
Develop a flexible, scalable template engine with support for various server-side programming languages. This simplfies the process of switching your website to another server-side language in which case half the work would have already been done for you.
Less code, same result.
Loops for repeating elements based on server-side lists or range values (inclusive or exclusive).
Conditional elements based on server-side variables.
Conditional attributes based on server-side variables.
Ability to include other template files and passing data to the included template via attrbutes (same as in HTML).
Interpolated string values.
Variable manipulation operations (length
, upper
, lower
, escape
, etc).
Single or double quoted string. Your preference.
Language support with syntax highlighting in Visual Studio Code.
Object Oriented Programming and development.
Query Builery with Prepared Statements for database access.
Easy REST API Implementation.
Email builder with template or plain text.
Input validation builder with data sanitization and operations for required fields, matching value type, length, patterns, etc.
File upload helper with image or file type verification, size limit, etc.
Multi-language support with an integrated translation builder.
Helper functions for manipulation of numeric values, text, Date and Time.
Random code generator functions with options for including letters, numbers and/or special characters.
Security features for request verification & validation, SQL injection preventation & CSRF protection.
And much more...