1. Go to this page and download the library: Download xlited/lamx 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/ */
xlited / lamx example snippets
namespace App\View\Components;
use Xlited\Lamx\Components\HtmxComponent;
class Todo extends HtmxComponent
{
public function __construct(public int $id, public string $title, public bool $done = false)
{
}
// Actions are public methods. They run against the component as it was rendered.
public function toggle(): void
{
$this->done = ! $this->done;
Todo::where('id', $this->id)->update(['done' => $this->done]);
}
}
class TodoForm extends HtmxComponent
{
protected function rules(): array
{
return ['title' => 'title']);
return [static::make(), Todo::make($todo)];
}
}