Rila is a data-oriented framework for WordPress with rapid front-end development in mind. It includes a set of lot of lightweight and highly extendable class wrappers, which let you structure you code properly in a MVC-like manner.
- Wrapper classes, which allow for easy and seamless access to WordPress data.
- Supports pure PHP, Twig and Blade templates out of the box. Other template engines can be easily used.
- Focused on performance: Data is available on demand and is never loaded in advance.
- Integrates seamlessly with plugins for custom fields, has a special helper for Advanced Custom Fields.
- Built with extensibility in mind: You can finally separate your logic from your views properly.
- Well-documented code and thorough documentation
- Extremely intuitive
- Smart default context: Everything, related to the current page is already available and waiting for you.
Your single.php (controller) file:
rila_view( 'single' )->render();
Your single.twig (view) file:
{% extends "base.twig" %}
{% block content %}
<h1>{{ post.title }}</h1>
<p class="entry-meta">Posted on {{ post.date }} at {{ post.date.time }} by {{ post.author.name }}</p>
<div class="rte">
{{ post.content }}
</div>
{% if post.categories %}
<p>Belongs to {{ post.categories }}</p>
{% endif %}
{% endblock %}
Beautiful, isn't it?
- Download this repository as a WordPress plugin
- Make sure that you have Composer installed and run
composer install
within the plugin's folder - Activate the plugin
- Read the wiki and benefit
The concept of data mapping allows you to have consistent and predictable properties for item attributes, meta and more. As an example from within the framework, you could have a definition like this:
$this->translate(array(
'image' => '_thumbnail_id'
));
$this->map(array(
'_thumbnail_id' => 'image'
));
That code allows you you to use post.image
instead of post._thumbnail_id
and the value would be an actual image object, so you can go ahead and simply use this within your templates:
{{ post.image }}
Mapping does not only apply to simple objects though - it's being heavily used throughout the whole plugin. You can read more about the topic in the wiki.
All of the functionality of the plugin is described in the Wiki.
The framwork is being developed by me, Radoslav Georgiev, web developer at DigitalWerk.
Contributions and pull requests are welcome ;)