PHP code example of spatie / laravel-html

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

    

spatie / laravel-html example snippets


// config/app.php
'aliases' => [
    ...
    'Html' => Spatie\Html\Facades\Html::class,
];

html()->span()->text('Hello world!');

$icon = html()->span()->class('fa');

$icon->class('fa-eye'); // '<span class="fa fa-eye"></span>'
$icon->class('fa-eye-slash'); // '<span class="fa fa-eye-slash"></span>'

// This will try to resolve an initial value, and fall back to '[email protected]'
$email = html()->email('email', '[email protected]');

// This will always have '[email protected]' as it's value
$email = html()->email('email')->value('[email protected]');