kominfogusit/laravel-helper

Reusable helper utilities for Laravel 12 and 13 applications.

Maintainers

Package info

gitlab.com/gusit-kominfo-dev/laravel-helper

Issues

pkg:composer/kominfogusit/laravel-helper

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

v0.0.4 2026-04-15 02:38 UTC

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, and x-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.0 or ^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.axios for remote select and AJAX dependent select features

The package installs these runtime dependencies with Composer:

  • blade-ui-kit/blade-icons
  • mallardduck/blade-lucide-icons
  • afatmustafa/blade-hugeicons
  • php-flasher/flasher-laravel
  • php-flasher/flasher-noty-laravel
  • php-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

ComponentUse caseDocumentation
x-laravel-helper::form.inputText-like input fields with label, hint, errors, Livewire attributes, and accessibility fallback.Form Input
x-laravel-helper::form.checkboxCheckbox fields with label, description, checked state, errors, and old() support.Form Checkbox
x-laravel-helper::form.textareaTextarea fields with label, hint, errors, rows, and Livewire attributes.Form Textarea
x-laravel-helper::form.selectStatic select fields and AJAX cascade select fields.Form Select
x-laravel-helper::buttonButton or link actions with variants, loading state, icons, and icon-only mode.Button
x-laravel-helper::linkStyled anchors with variants, underline behavior, icons, and disabled state.Link
x-laravel-helper::badgeSmall labels with variants, tones, sizes, icons, and dot indicator.Badge
x-laravel-helper::cardContent surfaces with optional header, footer, status variant, and wrapper tag.Card
x-laravel-helper::modalAlpine-powered dialog with open/close/toggle events and slots.Modal
x-laravel-helper::select-remoteRemote-search select with hidden input, hydration, and parent-child events.Select Remote
x-laravel-helper::spinnerLoading indicator for forms, buttons, and inline loading areas.Spinner
x-laravel-helper::table-filterQuery-string filter toolbar with quick search, modal filters, and dependent selects.Table Filter
x-laravel-helper::table-indexData 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\IndexQueryService
  • Indrahulu\LaravelHelper\Services\ExceptionService
  • Indrahulu\LaravelHelper\Concerns\HasEnumOptions
  • Indrahulu\LaravelHelper\Concerns\PreservesIndexState
  • Indrahulu\LaravelHelper\LaravelHelper
  • LaravelHelper facade alias
  • laravel_helper_greet(), laravel_helper_title(), and laravel_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.