PHP code example of validaide / html-builder

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

    

validaide / html-builder example snippets


public function userStateToIcon(User $user): string
{
  return sprintf('<span class="%s" id="%s" data-username="%s"></span>', strtolower($user->getState()), $user->getId(), $user->getUsername()):
}

public function userStateToIcon(User $user): HTMLTag
{
  return HTML::create('span')
          ->class(strtolower($user->getState())
          ->id($user->getId())
          ->attr('data-username',$user->getUsername());
}

   HTML::create('span')
   

   HTML::create('h1')->text('Heading 1');
   

   HTML::create('div')->id('div-1)->tag('div')->id('div-2);