I’ve just finished working on my fork of the Liquid template engine.
Liquid is a templating library which was originally developed for usage with Ruby on Rails in Shopify. It uses a combination of tags, objects, and filters to load dynamic content. They are used inside Liquid template files, which are a group of files that make up a theme.
Here is a simple example:
The implementation my fork is based on was a little outdated and I decided that I could make some improvements to it.
Namespaces
Namespaces were added. Now all classes are under Liquid
namespace. The library now implements PSR-4. The minimum required PHP version is 5.3
now.
Composer
You can now install the library via composer. Here is the package’s page.
New standard filters
Implemented new standard filters: sort
, sort_key
, uniq
, map
, reverse
, slice
, round
, ceil
, floor
, strip
, lstrip
, rstrip
, replace
, replace_first
, remove
, remove_first
, prepend
, append
.
For the full list of supported filters read the Ruby implementation’s wiki page.
New tags
raw
tag was added. The implementation of unless
tag is in plans. You’re welcome to contribute.