PHP code example of stefan-wiebe / elements

1. Go to this page and download the library: Download stefan-wiebe/elements 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/ */

    

stefan-wiebe / elements example snippets


use Elements\Element;

$attributes = [
	'id' => 'wrap-god',
	'class' => ['fresh', 'mexican', 'tortilla'],
];

$div = new Element('div', $attributes);

use Elements\Element;

$div = Element::withClasses('div', 'undetected unexpected');

$div['id'] = 'night-witch';

$div['class'][] = 'wings-of-glory';
$div['class'][] = 'tell-the-story';

$div['class'] = ['deviation', 'aviation'];
// or
$div['class'] = 'deviation aviation';

$div['style']['display'] = 'none'; // Stealth perfected

$div['style'] = 'display: none; background: linear-gradient(to bottom, red, blue);'

$div = Element::withClasses('div', 'form-group');

$input = new Element('input');
$input['type'] = 'text';

$div->addContent($input);

echo $div;

$someString .= (string) $div;