Skip to content

stephenfrank/Farser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages