BMC/UUP-WEB-COMPONENT - Web components library for PHP

Tired of writing HTML?Then this library can help you by providing an OOP approach were you instantiate widget, container or element classes and call render to generate HTML.

Each component has props that defines styling in an abstract way. It also has the attr, class, style and event collections that maps to HTML attributes, CSS classes/inline style and Javascript event handlers.

Rendering

One of the goals are also to abstact away CSS-styling. The render transformer uses properties defined on objects to render the web component in prefered style. The library user can define their own render transformer.

The default render transformer is paragon that produces HTML targetting the W3.CSS library from properties defined in component objects:

    // 
    // Render widget button:
    // 
    $button = new Button("Download");
    $button->color->back = "red";
    $button->render();          // <button class="w3-btn w3-red">Download</button>

Tree structures can be created by addding child components. Call render on top level component and it should render any child component automatic.

See tutorial for a longer introduction. The examples directory contains an online setup that demonstrate some features of the library.