PHP code example of wscore / html

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

    

wscore / html example snippets


use WScore\Html\Html;

$html = Html::create('tagName')
            ->set('attribute', 'value')
            ->setContents('content');
echo (string) $html;

$html = Html::a('sample link')       // magic method to create a new tag and contents
            ->href('check.php')    // magic method to set href attribute
            ->target('_blank');

echo Form::open('check.php');
echo Form::input('checkbox', 'keep', 'alive')->class('form-element');
echo Form::close(); 

echo Html::create('ul')
            ->class('form-list')
            ->setContents(
                Form::input('text', 'name')->placeholder('name here...'),
                Form::input('radio', 'yes', 'here')
            );

echo Form::choices('test', [
    'val1' => 'label1', 
    'val2' => 'label2'], 
    'val2);

echo Form::choices('test', [
    'val1' => 'label1', 
    'val2' => 'label2'], 
    'val2)
    ->multiple();

echo Form::choices('test', [
    'val1' => 'label1', 
    'val2' => 'label2'], 
    'val2)
    ->expand(false);