Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 1.38 KB

readme.md

File metadata and controls

71 lines (57 loc) · 1.38 KB

Elementor

This library simplifies HTML elements rendering.

Installation

$ composer require piotrpress/elementor

Example

require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Elementor;
use PiotrPress\Elementor\Element;
use PiotrPress\Elementor\Attributes;

// Example #1
echo new Elementor( [
    [ 'div',
        [ 'class' => 'main' ],
        [
            [ 'input',
                [
                    'type' => 'submit',
                    'required'
                ]
            ],
            [ 'a',
                [
                    'href' => 'https://piotr.press',
                    'class' => [ 'red', 'border' ]
                ],
                'Click'
            ]
        ]
    ]
] );
// <div class="main"><input type="submit" required /><a href="https://piotr.press" class="red border">Click</a></div>

// Example #2
echo new Element( 'a', [
    'href' => 'https://piotr.press',
    'class' => [ 'red', 'border' ]
], 'Click' );
// <a href="https://piotr.press" class="red border">Click</a>

// Example #3
echo new Element( 'input', [
    'type' => 'submit',
    'required'
] );
// <input type="submit" required />

// Example #4
echo new Attributes( [
    'href' => 'https://piotr.press',
    'class' => [ 'red', 'border' ]
] );
// href="https://piotr.press" class="red border"

Requirements

PHP >= 7.4 version.

License

MIT