PHP code example of nowise / uup-web-component

1. Go to this page and download the library: Download nowise/uup-web-component library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nowise / uup-web-component example snippets


$element = new Element(array(), "p", "...");
$element->id = 12;
$element->data->order = 4885;
$element->render();     // <p id="12" data-order="4885">...</p>

$transformer = new CustomTransformer();
Transformer::setInstance($transfomer);

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

$transform = new MaterialDesignTransform();
$button->render($transform);

$button = new Button("Download");
$button->attr->color = "red";
$button->render();          // <button color="red">Download</button>

$button->attr->add("background-color", "red");

$button->attr->set(array(
    "color" => "red",
    "background-color" => "blue"
));

$button = new Button("Download", array(
    "style" => array(           // Define inline CSS
            ...     
    ),
    "event" => array(           // Define event handlers
            ...     
    ),
));

$div = new Div();
$p1 = $div->add(new Paragraph("Some text here"));
$p2 = $div->add(new Paragraph("More text here"));
$div->render();     // <div><p>Some text here</p><p>More text here</p></div>