/html

Handy library to generate HTML

Primary LanguagePHPBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Yii HTML


The package ...

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage

REQUIREMENTS:

  • The minimum requirement by this project template that your Web server supports:
    • PHP 7.4 or higher.

INSTALLATION:

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this project template using the following command:

composer require yiisoft/html

General usage

use Yiisoft\Html\Html;

<?= Html::tag('meta', '', ['http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge']) ?>
<?= Html::tag('meta', '', ['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1']) ?>

<?= Html::cssFile($aliases->get('@css/site.css'), ['rel' => 'stylesheet']); ?>

<?= Html::cssFile(
    'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css',
    [
        'rel' => 'stylesheet',
        'integrity' => 'sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T',
        'crossorigin' => 'anonymous'
    ]
); ?>

<?= Html::beginTag('footer', ['class' => 'footer']) ?>
    <?= Html::beginTag('div', ['class' => 'container flex-fill']) ?>
        <?= Html::beginTag('p', ['class' => 'float-left']) ?>
        <?= Html::endTag('p') ?>
        <?= Html::beginTag('p', ['class' => 'float-right']) ?>
            <?= 'Powered by' ?>
            <?= Html::a(
                'Yii Framework',
                'http://www.yiiframework.com/',
                ['rel' => 'external']
            ) ?>
        <?= Html::endTag('p') ?>
    <?= Html::endTag('div') ?>
<?= Html::endTag('footer') ?>