Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Ladwire Module Laravel Package

ladbu/laravel-ladwire-module

Modular Laravel package adding Ladwire (Livewire) components and Flux UI to fresh projects: install dashboard, user management (CRUD, search, pagination), and settings modules via artisan installer. PHP 8.2+, Laravel 11/12, Livewire 3/4.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install the package in an existing Laravel project:

    composer require ladbu/laravel-ladwire-module
    

    Or for fresh projects, use the installer (if available in future versions).

  2. Publish assets (if needed):

    php artisan vendor:publish --provider="Ladbu\LaravelLadwireModule\LadbuServiceProvider" --tag="public"
    
  3. Run migrations (if included in the package):

    php artisan migrate
    
  4. Register the module in your routes/web.php:

    use Ladbu\LaravelLadwireModule\Http\Controllers\ModuleController;
    Route::middleware(['auth'])->group(function () {
        Route::get('/dashboard', [ModuleController::class, 'dashboard']);
        Route::prefix('users')->group(function () {
            Route::get('/', [ModuleController::class, 'users']);
            Route::get('/create', [ModuleController::class, 'createUser']);
            // ... other user routes
        });
    });
    
  5. First use case: Access /dashboard to see the pre-built Ladwire-powered dashboard with Flux UI components.


Key Starting Points

  • Module Structure: Explore resources/modules/ (if using v1.1.0+) for modular components.
  • Ladwire Components: Check app/Http/Livewire/ for pre-built components (e.g., DashboardComponent, UserManagementComponent).
  • Flux UI Docs: Refer to Flux UI documentation for styling and customization.
  • Configuration: Publish the config file:
    php artisan vendor:publish --provider="Ladbu\LaravelLadwireModule\LadbuServiceProvider" --tag="config"
    
    Then customize config/ladbu.php (e.g., module paths, default settings).

Implementation Patterns

Core Workflows

1. Modular Integration

  • Install only what you need: Use the --module flag (if supported in future versions) or manually enable/disable modules in config/ladbu.php:
    'modules' => [
        'dashboard' => true,
        'user_management' => true,
        'settings' => false, // Disable if unused
    ],
    
  • Extend existing modules: Override module views or components by placing them in resources/modules/[module-name]/views/ or app/Http/Livewire/[Module]Component.php.

2. Ladwire + Flux UI Pattern

  • Component-based development: Extend Ladbu\LaravelLadwireModule\Livewire\BaseComponent for consistency:
    namespace App\Http\Livewire;
    use Ladbu\LaravelLadwireModule\Livewire\BaseComponent;
    
    class CustomComponent extends BaseComponent {
        public function mount() {
            $this->title = 'Custom Title';
        }
    }
    
  • Flux UI integration: Use Flux components in Blade templates:
    <x-flux.button type="primary" @click="openModal">
        Action
    </x-flux.button>
    
    Or directly in Ladwire components:
    public function render() {
        return view('livewire.custom-component', [
            'button' => '<x-flux.button>Click Me</x-flux.button>',
        ]);
    }
    

3. Dashboard Customization

  • Override dashboard layout: Copy resources/views/modules/dashboard/layout.blade.php to resources/views/modules/dashboard/ and modify.
  • Add custom widgets: Extend the dashboard by adding new Ladwire components to the widgets array in config/ladbu.php:
    'dashboard' => [
        'widgets' => [
            'recent-activity',
            'custom-widget', // Your custom component
        ],
    ],
    

4. User Management

  • Customize user fields: Override the UserManagementComponent or extend it:
    namespace App\Http\Livewire;
    use Ladbu\LaravelLadwireModule\Livewire\UserManagementComponent as BaseUserComponent;
    
    class UserManagementComponent extends BaseUserComponent {
        protected $searchFields = ['name', 'email', 'role']; // Add custom fields
    }
    
  • Add custom actions: Extend the actions method in the component to include buttons like "Suspend" or "Audit":
    public function actions() {
        return array_merge(parent::actions(), [
            'suspend' => 'Suspend',
        ]);
    }
    

5. Settings Management

  • Add custom settings: Extend the settings table by publishing migrations:
    php artisan vendor:publish --provider="Ladbu\LaravelLadwireModule\LadbuServiceProvider" --tag="migrations"
    
    Then create a new migration for your settings:
    php artisan make:migration add_custom_settings_to_ladbu_settings_table
    
  • Bind settings to Ladwire: Use the Settings facade to access/modify settings:
    use Ladbu\LaravelLadwireModule\Facades\Settings;
    
    public function saveCustomSetting() {
        Settings::set('custom.key', $this->customValue);
    }
    

Integration Tips

  1. Authentication: Ensure your auth middleware (e.g., auth) is applied to module routes. The package assumes Laravel Breeze/Jetstream auth by default.
  2. Authorization: Use Laravel's gates/policies to restrict access to modules. Example:
    Gate::define('manage-users', function ($user) {
        return $user->isAdmin();
    });
    
    Then add to your component:
    public function canAccess() {
        return Gate::allows('manage-users');
    }
    
  3. Localization: Override language files in resources/lang/ to customize labels/buttons.
  4. Testing: Use Ladwire's testing helpers:
    $this->livewire(UserManagementComponent::class)
        ->assertSee('Users')
        ->call('search', 'test');
    

Gotchas and Tips

Pitfalls

  1. Version Mismatches:

    • Laravel 11 vs. 12: Some helper methods may differ. Check the package's composer.json for Laravel version constraints.
    • Livewire 3 vs. 4: Ladwire components may need adjustments for syntax changes (e.g., $this->dispatch() vs. $this->emit()).
    • Flux UI 1 vs. 2: Component props or slots may break. Test thoroughly after updates.
  2. Module Auto-Loading:

    • If modules don’t load, ensure:
      • The modules array in config/ladbu.php is correctly configured.
      • No typos in module names (case-sensitive).
      • The resources/modules/ directory exists and is readable.
  3. Asset Conflicts:

    • Flux UI or Ladwire assets might conflict with existing Tailwind/Alpine setups. Use @vite() or @stack directives carefully:
      @vite(['resources/css/app.css', 'resources/js/app.js'])
      @stack('scripts')
      
    • If using Laravel Mix, ensure no duplicate app.js/app.css files are included.
  4. Database Seeding:

    • The package may include seeders for demo data. Disable them in DatabaseSeeder.php if not needed:
      // database/seeders/DatabaseSeeder.php
      Ladbu\LaravelLadwireModule\Database\Seeders\ModuleSeeder::run(); // Remove or comment out
      
  5. Caching Issues:

    • Clear views, config, and route caches after changes:
      php artisan view:clear
      php artisan config:clear
      php artisan route:clear
      

Debugging Tips

  1. Ladwire Debugging:

    • Enable Ladwire logging in config/livewire.php:
      'log' => env('LIVEWIRE_LOG', true),
      
    • Check storage/logs/livewire.log for component lifecycle events.
  2. Flux UI Debugging:

    • Use Flux’s built-in debug tools (if enabled) or inspect the DOM for missing classes/props.
    • Verify Flux is properly installed via Vite:
      npm run dev
      
  3. Route Debugging:

    • Dump routes to check if module routes are registered:
      php artisan route:list | grep ladbu
      
  4. Component Lifecycle:

    • Override mount(), hydrate(), or updated() in your Ladwire components to log state changes:
      public function mount() {
          \Log::info('Component mounted', ['data' => $this->data]);
      }
      

Extension Points

  1. Custom Modules:
    • Create a new module by copying an existing one (e.g., resources/modules/dashboard) and renaming it.
    • Register it in `config/ladbu
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
monarobase/country-list
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity