Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Farser

An experiment in template parsing (in PHP) that's pretty simple minded and tries to implement nested scopes in a non-scary way.

And... look ma, no regex!

Turns

{$A fiz="baz" dir="ls"}foo{dir}{$B dir="dir"}bar{fiz}{dir}{/$B}{/$A}

into

foolsbarbazdir

also handles a simple callback mechanism

$farser = new Farser();
$farser->setRaw('{$A}{foo}{$B}{foo}{dir}{/$B}{/$A}');
$farser->addCallback('A', function (& $scope)
{
$scope['vars']['foo'] = 'baz';
});
$farser->addCallback('B', function (& $scope)
{
$scope['vars']['dir'] = 'ls';
});
echo $farser->parse();
// output: bazbazls

About

An experiment in parsing (in PHP) that's pretty simple minded

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages