Skip to content

devsmt/php_markaby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php_markaby

php html builder, inspired by Markaby ruby gem

ruby code:

    require 'markaby'

    mab = Markaby::Builder.new
    mab.html do
      head { title "Boats.com"
      body do
        h1 "Boats.com has great deals"
        ul do
          li "$49 for a canoe"
          li "$39 for a raft"
          li "$29 for a huge boot that floats and can fit 5 people"
        end
      end
    end
    puts mab.to_s

equivalent PHP code:

    use \Markaby\TagBuilder as T;

    $m = new \Markaby\Builder();
    $m->head( array('title' => "Boats.com") )
        ->html5(function(){
          return
          T::body(function(){
            return
            T::h1("Boats.com has great deals").
            T::ul(function(){
              return
              T::li("$49 for a canoe").
              T::li("$39 for a raft").
              T::li("$29 for a huge boot that floats and can fit 5 people");
            });
          });
        });
    echo $m;

About

php html builder, inspired by Markaby ruby gem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages