Releases: splashsky/modello
v4.3.2
Adds new syntax for @block('key', 'string')
so you can define blocks on a single line, beautifully! Line breaks are not allowed in the value string, so keep that in mind. Inline blocks will also overwite previously defined blocks, so be cautious!
I also merged a couple of the handlers to save on space and function definitions.
v4.2.1
- Re-added the output buffer to the rendering step.
- Implemented a recursive includes step to the recompile check, so that any includes above your view can also trigger a recompile. You may never need to disable caching again!
- Implemented
@hasblock
and@blockmissing
directives as conditionals for the presence of blocks. If you want a view to show something only when a block is defined, you can use@hasblock
. When you want the view to show something when there's no block by that name,@blockmissing
will work.
v4.0.0 - Version 4 update!
👋 Aloha! Been a long time since a new release. This one isn't spectacularly crazy, but it does contain 100% breakage. Modello is no longer a static
-based class, and instead is a traditional class that requires instantiation. Here's the work that's been done:
- Rewrote class to a traditional class (no static methods except
::parse()
) - Constructor allows specifying path to views and cache at creation
- Updated regex in the conditional handlers to allow nested parentheses (this wasn't working before)
- Cache is now enabled by default (sensible default behavior)
- Updated documentation to reflect all features of the compiler
- Only the conditional and loop directives (
@if ()
and@foreach ()
) can have a space between the directive and the parentheses. This isn't true for@yield
or@block
anymore, as I'm trying to replacepreg
withstr
when I can.
And as a general status update, I do intend on making additional improvements as I start and continue work on some personal projects. Expect more features and improvements in the future! 😁
v3.2.3 - 🔧 Change include to catch-all
👋 Aloha! Due to using \w
as the RegEx in catching the content of the @include/extends
directives, you couldn't specify a subfolder for views (layouts.layout
). As such, this has been fixed as I replaced the previous capture \w+
with a catch-all .*?
.
v3.2.2 - 💡 Re-add missing setter methods
Missed the setter methods on the rewrite. They've been re-added! 🍹
v3.1.2 - ✏️ Rewrite Modello v3
See the recent PR #5 for what went on with this release. Continue to use the engine the same way! 👋🏻
v3.0.2 - 🔧 One last time!
🔧 One more fix for Composer!
v3.0.1 - 🔧 Fix package for Composer
I guess I got the namespacing wrong for Composer, so you weren't able to use the package easily in projects. This should be corrected now!
v3.0.0 - 🍍 Fresh beginnings!
Aloha! 👋
The last time I updated this repo was almost a year ago. Long time no see! I've also picked up on some new coding ideas I wanted to get around to. The version of Modello before this one was actually my second rewrite of the library - meaning that the v1 was a bit of a misnomer. Thus, with this complete rewrite, I'm getting back on track with versioning.
Any major updates, usually ones that will break old code, will now see a major version bump. Updates and new functionality that does not break old code will get a minor version bump. Bugfixes and small improvements will get a bugfix version bump. Simple!
With all that out of the way, welcome to Modello v3! Modello is now entirely static, and a lot of the magic happens within. You no longer have to go through the pain of manually creating and maintaining an instance, instead now simply calling Modello::view()
when you need to render a view.
The methodology behind both the parsing and the caching has been updated, as well. By default, Modello will (re)render all views and store the cached file. You can enable caching mode either by updating the class property itself ($cacheEnabled
), or you can use the Modello::setCacheEnabled(true)
method. It will then use file modified times and other criteria to determine whether or not recompiling is necessary. Most often in production, it won't be - thus saving precious moments in that render time for users! ⏱️
For compiling, all related directives are now a simple preg_replace
wherein we use string formatting to transpose the input and directives into PHP code in the cached file. Whether this has a performance benefit over old Modello or not I'm not really sure, but creating new directives in the future will be very simple and easy. 👍
To sum it all up, we have a brand new version of Modello. Have fun! 🍹
v1.2.5 - Controls, loops, includes, oh my!
Hey there! This release has all new functionality! I've improved the echo statement parser to ensure consistent parsing of echo tags, as they had a minor issue of being merged in the previous release. I've also made the return strings of the parsing functions into literals, to eliminate concatenation.
Aside from that, we have support for new directives!
// This is the if-else syntax
@if(condition)
// ...
@elseif(condition)
// ...
@else
// ...
@endif
// This is the foreach syntax
@foreach($array as $key => $value)
{{ $key }} equals {{ $value }}
@endforeach
// This is a comment
{{-- I won't show up in the HTML or in the compiled template file! --}}
// This is the almighty include directive!
@include('path.to.template')
And I rewrote the readme to be a more complete guide.
Have fun!