kominfogusit / laravel-helper
Reusable helper utilities for Laravel 12 and 13 applications.
Requires
- php: ^8.2
- afatmustafa/blade-hugeicons: ^2.0
- blade-ui-kit/blade-icons: ^1.9
- illuminate/support: ^12.0|^13.0
- illuminate/view: ^12.0|^13.0
- mallardduck/blade-lucide-icons: ^1.26
- php-flasher/flasher-laravel: ^2.5
- php-flasher/flasher-noty-laravel: ^2.5
- php-flasher/flasher-sweetalert-laravel: ^2.5
Requires (Dev)
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.5
This package is auto-updated.
Last update: 2026-04-14 19:44:02 UTC
README
Reusable Laravel 12/13 helpers for building admin-style application screens: Blade UI components, publishable layout assets, table/filter helpers, remote selects, modal interactions, and PHP utilities.
What This Package Provides
- Namespaced Blade components such as
x-laravel-helper::button,x-laravel-helper::form.input,x-laravel-helper::modal,x-laravel-helper::table-filter, andx-laravel-helper::table-index. - Publishable layout, CSS, and JavaScript assets for the default UI theme.
- Public utilities for index queries, exception messages, enum options, and preserving index query state.
- A small helper service, facade, and global functions for greeting, title formatting, and slug generation.
Requirements
- PHP
^8.2 - Laravel
^12.0or^13.0 - Vite for apps that use the published layout or import the published CSS from
resources/css/app.css - Alpine.js for interactive components such as modal, table filter, table index controls, remote select, and cascade select
window.axiosfor remote select and AJAX dependent select features
The package installs these runtime dependencies with Composer:
blade-ui-kit/blade-iconsmallardduck/blade-lucide-iconsafatmustafa/blade-hugeiconsphp-flasher/flasher-laravelphp-flasher/flasher-noty-laravelphp-flasher/flasher-sweetalert-laravel
Installation
Install the package with Composer:
composer require kominfogusit/laravel-helper
Laravel auto-discovers the service provider and facade alias.
Publish the config file:
php artisan vendor:publish --tag=laravel-helper-config
Publish the default layout, CSS, and JavaScript assets:
php artisan vendor:publish --tag=laravel-helper-core-ui
Install Flasher assets and configuration:
php artisan flasher:install
Import the published CSS in resources/css/app.css:
@import './vendor/laravel-helper/default.css';
default.css imports the package stylesheets for layout, badge, button, card, link, modal, select-remote, spinner, table-filter, table-index, and form components.
Install Alpine.js:
npm install alpinejs
Enable Alpine in resources/js/app.js:
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
Alpine is required for interactive components such as modal, table filter, table index controls, remote select, and cascade select.
Quick Usage
Use the published layout when you want the fastest starting point for the package shell:
@extends('layout.default')
@section('page_heading', 'Dashboard')
@section('page_subheading', 'Overview aplikasi dan aktivitas terbaru.')
@section('content')
<x-laravel-helper::card>
<p>Konten halaman ditulis di sini.</p>
</x-laravel-helper::card>
@endsection
Update the published sidebar menu in resources/views/layout/sidebar.blade.php:
@php
$standaloneMenus = [
[
'label' => 'Dashboard',
'href' => route('dashboard'),
'active' => 'dashboard',
'icon' => 'lucide-layout-dashboard',
],
];
$sidebarSections = [
[
'label' => 'Master Data',
'menus' => [
[
'label' => 'Users',
'href' => route('users.index'),
'active' => 'users.*',
'icon' => 'lucide-users',
],
[
'key' => 'settings',
'label' => 'Settings',
'icon' => 'lucide-settings',
'children' => [
[
'label' => 'Roles',
'href' => route('roles.index'),
'active' => 'roles.*',
],
],
],
],
],
];
@endphp
Update the user menu in resources/views/layout/topbar.blade.php:
@php
$userMenuIdentity = [
'name' => auth()->user()->name,
'email' => auth()->user()->email,
'role_label' => 'Administrator',
'role_badge_variant' => 'primary',
'role_badge_tone' => 'soft',
];
$userMenuActions = [
[
'label' => 'Profile',
'href' => route('profile.edit'),
'icon' => 'lucide-user',
],
[
'label' => 'Logout',
'href' => route('logout'),
'icon' => 'lucide-log-out',
],
];
@endphp
User menu actions are rendered as links. If your logout route requires a POST request, replace the logout link in topbar.blade.php with your app's logout form or button.
Use a form input:
<x-laravel-helper::form.input
name="name"
label="Name"
placeholder="Enter a name"
required
/>
Use an action button:
<x-laravel-helper::button type="submit" variant="primary">
Save
</x-laravel-helper::button>
Use a table index:
<x-laravel-helper::table-index
:data-list="$users"
:data-columns="[
['key' => 'name', 'label' => 'Name', 'sortable' => true, 'sortKey' => 'name'],
['key' => 'email', 'label' => 'Email'],
]"
/>
Components
| Component | Use case | Documentation |
|---|---|---|
x-laravel-helper::form.input | Text-like input fields with label, hint, errors, Livewire attributes, and accessibility fallback. | Form Input |
x-laravel-helper::form.checkbox | Checkbox fields with label, description, checked state, errors, and old() support. | Form Checkbox |
x-laravel-helper::form.textarea | Textarea fields with label, hint, errors, rows, and Livewire attributes. | Form Textarea |
x-laravel-helper::form.select | Static select fields and AJAX cascade select fields. | Form Select |
x-laravel-helper::button | Button or link actions with variants, loading state, icons, and icon-only mode. | Button |
x-laravel-helper::link | Styled anchors with variants, underline behavior, icons, and disabled state. | Link |
x-laravel-helper::badge | Small labels with variants, tones, sizes, icons, and dot indicator. | Badge |
x-laravel-helper::card | Content surfaces with optional header, footer, status variant, and wrapper tag. | Card |
x-laravel-helper::modal | Alpine-powered dialog with open/close/toggle events and slots. | Modal |
x-laravel-helper::select-remote | Remote-search select with hidden input, hydration, and parent-child events. | Select Remote |
x-laravel-helper::spinner | Loading indicator for forms, buttons, and inline loading areas. | Spinner |
x-laravel-helper::table-filter | Query-string filter toolbar with quick search, modal filters, and dependent selects. | Table Filter |
x-laravel-helper::table-index | Data table with sortable headers, formatting, row actions, rows-per-page, and pagination. | Table Index |
Utilities
The package exposes consumer-facing utilities for application code:
Indrahulu\LaravelHelper\Services\IndexQueryServiceIndrahulu\LaravelHelper\Services\ExceptionServiceIndrahulu\LaravelHelper\Concerns\HasEnumOptionsIndrahulu\LaravelHelper\Concerns\PreservesIndexStateIndrahulu\LaravelHelper\LaravelHelperLaravelHelperfacade aliaslaravel_helper_greet(),laravel_helper_title(), andlaravel_helper_slug()
See Consumer Utilities for copy-paste examples.
Documentation
Development
composer install
composer test
Package releases follow Git tags, starting from v0.1.0 for the first preproduction release.