goodbye-html

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

Downloads
373
Stars
6
Committers
2

Bot releases are hidden (Show)

goodbye-html - v2.9.5 Latest Release

Published by SerhiiCho 8 months ago

  • Refactored match statement in Evaluator.php file
goodbye-html - Release v2.9.4

Published by SerhiiCho 9 months ago

  • Add comment description to the case in ParserOption ENUM
goodbye-html - v2.9.3

Published by SerhiiCho 9 months ago

  • Moved phpunit from "require" to "require-dev" in composer.json file
goodbye-html - v2.9.2

Published by SerhiiCho 9 months ago

  • Added more tests to EvaluatorTest.php for checking if/elseif/else statements logic
  • Fixed wrong printing of the expression statement when calling a String() method on it
goodbye-html - v2.9.1

Published by SerhiiCho 9 months ago

  • Inline one method in CoreParserTest.php because it was used only in one place
  • Change IfStatement ast node to a better implementation
goodbye-html - v2.9.0

Published by SerhiiCho 10 months ago

  • Simplified Lexer code
  • Add support for grouped expressions. Now you can use them like this: {{ (1 + 2) * 3 }}
goodbye-html - v2.8.0

Published by SerhiiCho 11 months ago

  • Added support for comparison operators like ==, ===, !==, !=, <, >, <=, >=. 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 }}
  • Improved error handling for operators
goodbye-html - v2.7.0

Published by SerhiiCho 11 months ago

  • Added more tests to make sure that everything works as expected
  • Added more info to the README.md file
  • Added added assign statement to the BNF grammar
  • Added a third parameter to a Parser.php which excepts ParserOption ENUM
goodbye-html - v2.6.0

Published by SerhiiCho 11 months ago

  • Added elseif statements to a BNF grammar
  • Added .gitattributes file to ignore HTML files in tests/files directory
  • Updated code to level 9 of the PHP Stan static analysis tool
  • Fixed a typo in the change log file
  • Added variable declaration statement support. Now you can declare variables like this: {{ $name = 'Anna' }}. Variable declaration is a statement, and must be surrounded with curly braces
  • 🐛 Bug fix, $index variable was accessible outside of the loop. Now, it will throw an error that variable $index is undefined.
goodbye-html - v2.5.0

Published by SerhiiCho 11 months ago

  • Added support for 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 }}
  • Added PHP Stan static analysis tool
  • Added CS Fixer code style fixer
  • 🐛 Bug fixes in the Parser.php class related to readonly properties being set later in the code
  • Improved error handling
  • Changed tests back to PHPUnit from Pest, because Pest is kinda sucks and doesn't work as I want. It lacks of error descriptive error messages when tests fail. It's hard to debug. So, I decided to go back to PHPUnit
  • 🐛 Bug fix of the error that was happening when you condition of the if statement was false
  • Installed CS Fixer to the project
goodbye-html - v2.4.0

Published by SerhiiCho 11 months ago

  • Added support for math expressions: add (+), subtract (-), multiply (*), divide (/), modulo (%). Now you can use it like this: {{ 1 + 2 }}, {{ 1 - 2 }}, {{ 1 * 2 }}, {{ 1 / 2 }}, {{ 1 % 2 }}
  • Added BNF (Backus-Naur Form) grammar
  • Changed if and loop expression to statements
  • Refactored and restructured AST nodes for better readability
goodbye-html - v2.3.0

Published by SerhiiCho 11 months ago

  • Removed final keyword from all the classes to make it easier to extend the package
  • Introduced Pratt Parsing
  • Replaced PHPUnit with Pest testing framework
  • Fixed bug with wrong ternary expression precedence. Negation operator (!) was negating the whole ternary expression instead of the boolean part of it. Now, the negation operator (!) will negate only the boolean part of the ternary expression. Before: (!(true ? 1 : 0)). After: ((!true) ? 1 : 0).
  • Added concatenation for strings. Now you can use it like this: {{ 'Serhii ' . ' Cho' }}
goodbye-html - v2.2.0

Published by SerhiiCho 11 months ago

  • Added support for null type support. Now you can use null like this: {{ if null }}
  • Added negation operator (!). Now you can use it like this: {{ if !true }} or {{ if !false }}
  • Improved code readability to refactoring the Lexer class
goodbye-html - v2.1.0

Published by SerhiiCho 11 months ago

  • Changed the first parameter of the Parser class. Now, it accepts absolute path to the template file or a string with template content. Before, it was accepting only the path
  • Improved code readability to refactoring the Parser class
  • Added support for floats to the lexer and core parser
  • Bug fix, when you pass a relative path as a first argument to the Parser class. Now, it will throw an exception with a descriptive message
goodbye-html - v2.0

Published by SerhiiCho 11 months ago

  • Rewritten the whole package to proper Lexical Analyzer, Parser and Evaluator. Now you can do that you couldn't do before. Like using nested loops, if statements, ternary operators and so on.
  • Rewritten the whole documentation
  • Rewritten the tests
  • Dropped support for PHP versions below 8.2. Now, the minimum required PHP version is 8.2
  • Added BOOLEAN type support for the parser. Now you can use true and false like this: {{ if true }} or `{{ if false }}
  • Added STRING type support for the parser. Now you can use strings like this: {{ 'some string' }} or {{ if "some string" }}
  • Added quote escaping for strings. Now you can use strings like this: {{ 'some \'string\'' }} or {{ if "some \"string\"" }}
  • Added support for PHP 8.3
goodbye-html - v1.6.3

Published by SerhiiCho about 1 year ago

  • Added CHANGELOG.md file to the project
goodbye-html - v1.6.2

Published by SerhiiCho about 1 year ago

  • Installed Pint
  • Added Pint analyzer
  • Added support for PHP 8.2
goodbye-html - v1.6.1

Published by SerhiiCho over 3 years ago

  • Small fixes
goodbye-html - v1.6

Published by SerhiiCho almost 4 years ago

  • Added support for loops
  • Fixed various bugs
  • Added more tests
goodbye-html - v1.5

Published by SerhiiCho almost 4 years ago

  • Added support for ternary operator
  • Refactored code
  • Added more tests
  • Added more info to README.md
  • Added LISCENCE.md