PHP code example of artisanpack-ui / livewire-ui-components
1. Go to this page and download the library: Download artisanpack-ui/livewire-ui-components 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/ */
artisanpack-ui / livewire-ui-components example snippets
use ArtisanPackUI\Hooks\Facades\Action;
use ArtisanPackUI\Hooks\Facades\Filter;
// Add a class to every rendered button
Filter::add('ap.livewireUiComponents.componentClasses', function (array $classes, string $name) {
if ('Button' === $name) {
$classes[] = 'analytics-hook';
}
return $classes;
});
// Swap Font Awesome names for Heroicon names package-wide
Filter::add('ap.livewireUiComponents.iconAlias', function (string $name) {
return match ($name) {
'fa-home' => 'o-home',
'fa-user' => 'o-user',
default => $name,
};
});
// Log toasts to your analytics pipeline
Action::add('ap.livewireUiComponents.toastDispatched', function (string $type, string $title) {
analytics()->track('toast_shown', ['type' => $type, 'title' => $title]);
});
use ArtisanPack\LivewireUiComponents\Support\ModalBridge;
public function openConfirmDialog(): void
{
ModalBridge::willOpen('confirm-delete');
$this->dispatch('open-modal', id: 'confirm-delete');
}
bash
php artisan artisanpack:generate-theme
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.