PHP code example of leafs / ui
1. Go to this page and download the library: Download leafs/ui 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/ */
leafs / ui example snippets
use Leaf\UI\Component;
class Test2 extends Component
{
// every component needs a unique key
public $key = "test2";
public $count = 1;
public function increment()
{
$this->count++;
}
public function decrement()
{
$this->count--;
}
public function render()
{
// your UI will go here
return '
<body>
<div>
<div>Static text</div>
<button @click="decrement">-</button>
<h1>{{ $count }}</h1>
<button @click="increment">+</button>
</div>
</body>
';
}
}
use Leaf\UI;
2());