A very simple package for separating PHP logic from HTML or any other text. It allows you to insert variables, if/else statements and ternary operators into any text file and dynamically get parsed content of this file.
MIT License
Bot releases are hidden (Show)
Evaluator.php
filePublished by SerhiiCho 9 months ago
ParserOption
ENUMPublished by SerhiiCho 9 months ago
phpunit
from "require" to "require-dev" in composer.json
filePublished by SerhiiCho 9 months ago
EvaluatorTest.php
for checking if/elseif/else statements logicString()
method on itPublished by SerhiiCho 9 months ago
CoreParserTest.php
because it was used only in one placeIfStatement
ast node to a better implementationPublished by SerhiiCho 10 months ago
{{ (1 + 2) * 3 }}
Published by SerhiiCho 11 months ago
==
, ===
, !==
, !=
, <
, >
, <=
, >=
. Now you can use them like this: {{ if 1 == 1 }}
, {{ if 1 === 1 }}
, {{ if 1 !== 1 }}
, {{ if 1 != 1 }}
, {{ if 1 < 1 }}
, {{ if 1 > 1 }}
, {{ if 1 <= 1 }}
, {{ if 1 >= 1 }}
Published by SerhiiCho 11 months ago
README.md
fileParser.php
which excepts ParserOption
ENUMPublished by SerhiiCho 11 months ago
elseif
statements to a BNF grammar.gitattributes
file to ignore HTML files in tests/files
directory{{ $name = 'Anna' }}
. Variable declaration is a statement, and must be surrounded with curly braces$index
variable was accessible outside of the loop. Now, it will throw an error that variable $index is undefined.Published by SerhiiCho 11 months ago
elseif (<expression>)
and else if (<expression>)
statements like we have in PHP. You can use them like this: {{ if true }}<h1>True</h1>{{ elseif false }}<h1>False</h1>{{ else }}<h1>Something else</h1>{{ endif }}
Parser.php
class related to readonly properties being set later in the codeCS Fixer
to the projectPublished by SerhiiCho 11 months ago
{{ 1 + 2 }}
, {{ 1 - 2 }}
, {{ 1 * 2 }}
, {{ 1 / 2 }}
, {{ 1 % 2 }}
if
and loop
expression to statementsPublished by SerhiiCho 11 months ago
final
keyword from all the classes to make it easier to extend the package(!(true ? 1 : 0))
. After: ((!true) ? 1 : 0)
.{{ 'Serhii ' . ' Cho' }}
Published by SerhiiCho 11 months ago
null
type support. Now you can use null
like this: {{ if null }}
!
). Now you can use it like this: {{ if !true }}
or {{ if !false }}
Lexer
classPublished by SerhiiCho 11 months ago
Parser
class. Now, it accepts absolute path to the template file or a string with template content. Before, it was accepting only the pathParser
classfloats
to the lexer and core parserParser
class. Now, it will throw an exception with a descriptive messagePublished by SerhiiCho 11 months ago
true
and false
like this: {{ if true }}
or `{{ if false }}{{ 'some string' }}
or {{ if "some string" }}
{{ 'some \'string\'' }}
or {{ if "some \"string\"" }}
Published by SerhiiCho about 1 year ago
CHANGELOG.md
file to the projectPublished by SerhiiCho about 1 year ago
Published by SerhiiCho over 3 years ago
Published by SerhiiCho almost 4 years ago
Published by SerhiiCho almost 4 years ago