Strapper is an invention born out of wanting to never write open bracket, d-i-v, close bracket, space, space, open bracket, forward slash, d-i-v, close bracket… EVER AGAIN. Never, ever, ever again. $(#& HTML that’s our philosophy, and for you front-end developers out there… learn PHP or go find another job. I know, I know, that’s a bold and possibly delusional statement. Nonetheless, let me introduce Strapper, the PHP library that writes HTML/CSS for you so you don’t have too.
Strapper is made up of a tree and branches. The tree is a rendering object that contains branches, which contain more branches. In other words it’s a tree. When we call the tree render() method, it loops through all it’s branches and outputs the HTML from each branch. The branches are each objects, and they all extend the base class Strap_RenderBranch.
The core concept of Strapper is to build up (grow) branches from their most basic HTML elements such as a DIV. When we have a DIV we can make a Bootstrap ROW. When we have an IMG branch, we can put an image into a Bootstrap component. Eventually after we build up enough we can have a site section like a header or footer. And all the while we’re using the same simple branching system.