PHP code example of phpwine / optimizedhtml

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

    

phpwine / optimizedhtml example snippets


 // Structure 
 views
  |- Apps
  |- Components
  |- Doctrines

/* Installation via composer */ 
/* tml v2.2.2

 /** Local file PHPWine **/
 OptimizedHtml;

// Function Hooks @since v2.0
wine(  
  string $tag = '',
  string|callable|array $content = [],
  string|array $attr = []
  array $hooks = []
);

source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/wine.php


// Function Hooks @since v2.0
wcleared()
Source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/wcleared.php

wine_doctrine_init();
Source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/wine_doctrine_init.php

// Method Hooks @since v2.0
attr( 
  object|string $class = null,
  string|callable $call_back = null,
  mixed ...$attr
);

source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/attr.php


// Method Hooks @since v2.0
magic(
 object|string $class = null,
 string|callable $call_back = null,
 mixed ...$current_value
);

source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/magic.php


// Method Hooks @since v2.0
value(
 object|string|null $class = null,
 string|callable|null $call_back = null,
 mixed ...$args
);

source: https://github.com/PHPWine/PHPWine/blob/main/src/wine/hooks/value.php


// New in v2.0 soon Hooks 
echo wine(h1,'Hello World', [ id => 'wine_id'], $hooks = [
  ['top_your_hook_name_add_html_top',[ $one = 2, $two = 4] ],
  ['bottom_your_hook_name_add_html_bottom',[ $one = 'A', $two = 'B']]
 ]  
);

// You can now | Using key "string" top_ OR bottom_ followed by your hook name ... 
// ex. [  bottom_your_hook_name_add_html_bottom, [ $argu_1, .... ] ]
$hooks = [
 ['bottom_your_hook_name_add_html_bottom',[ $one = 'A', $two = 'B']] /* this will display in the bottom element html */
]  
 PHP
@since v1.4.0 OptimizedHtml
$this->wine::child => [
/*  ['div', $this->wine::value=>[ $this->wine->value((new Branding),'component_top_logo_header')]], this still works anyway */
    ['div', $this->wine::value=>[ $this->wine->value(MenuList::class,'component_top_right_menu', $this->links ) ]]
  ]
 ]);