Skip to content
Safouane Ahmed Salah edited this page May 8, 2021 · 5 revisions

Welcome to the PHP-React-Component wiki!

installation

composer require phpreact/component

usage

The PHP-React-Component enable the web developer to code elegantly and produce the lightweight web page.

simple as you can see here

 class CustomComponent extends Component{
    function render(){
        $divs = [];
        for($i=0; $i<5;$i++) $divs[] = new div('I am div', ['style'=> 'background:red;color:white']);
        return [
            new h1('Custom component width 5 red divs'),
            new div($divs),
        ];
    }
}

echo new CustomComponent 
/*
this produces 
<h1>Custom component width 5 red divs</h1>
<div>
  <div style="background:red;color:white">I am div</div>
  <div style="background:red;color:white">I am div</div>
  <div style="background:red;color:white">I am div</div>
  <div style="background:red;color:white">I am div</div>
  <div style="background:red;color:white">I am div</div>
</div>
*/
Clone this wiki locally