Installation:
composer require splittlogic/fw
This installs Livewire (v3.0.10) and Bootstrap (v5.3.2) as dependencies, along with any package-specific configurations.
Publish Configurations (if needed): Check if the package includes publishable assets (e.g., Blade views, JS/CSS, or config files) via:
php artisan vendor:publish --provider="Splittlogic\Fw\FwServiceProvider"
Verify the config/fw.php file exists (if applicable) and adjust settings like default Livewire components or Bootstrap themes.
First Use Case:
php artisan make:livewire ExampleComponent
Use Bootstrap classes directly in Blade templates (e.g., <div class="btn btn-primary">).composer test
Verify Dependencies:
Ensure no conflicts with existing Laravel/Livewire/Bootstrap versions. Check composer.json for version constraints.
Livewire + Bootstrap Integration:
p-3, bg-light) or components (e.g., <button class="btn btn-outline-danger">) in Livewire Blade views.
<div class="card">
<x-livewire:example-component />
</div>
row, col-*) in Livewire layouts for dynamic content.Asset Management:
resources/js/app.js:
import 'bootstrap';
import './fw-extensions'; // Hypothetical package-specific JS
@stack and @push directives to inject package-specific scripts/styles:
@push('fw-scripts')
<script src="{{ asset('fw/js/custom.js') }}"></script>
@endpush
Configuration-Driven Features:
livewire:init behavior) via config/fw.php:
'livewire' => [
'default_component' => 'app.views.Welcome',
'debug' => env('APP_DEBUG', false),
],
resources/sass/fw/_variables.scss:
$primary: #6f42c1;
@import "bootstrap/scss/bootstrap";
Modular Component Development:
// app/Http/Livewire/AlertComponent.php
public function render()
{
return view('livewire.alert-component', [
'message' => $this->message,
'type' => $this->type, // 'success', 'danger', etc.
]);
}
<!-- resources/views/livewire/alert-component.blade.php -->
<div class="alert alert-{{ $type }}">{{ $message }}</div>
Testing Patterns:
public function test_component_renders()
{
$this->livewire(ExampleComponent::class)
->assertSee('Expected Text')
->assertSee('btn-primary');
}
laravel-browsershot.Existing Projects:
composer why-not splittlogic/fw to check for version conflicts.Livewire + Alpine.js:
<div x-data="{ open: false }">
<button @click="open = true" class="btn btn-secondary">Toggle</button>
<x-livewire:modal wire:model="open" />
</div>
Package-Specific Features:
CHANGELOG.md (e.g., custom directives like @fwSlot).Performance:
data-bs-toggle:
<button class="btn btn-info" data-bs-toggle="tooltip" title="Tooltip">Hover</button>
wire:ignore to exclude static elements from reactivity:
<div wire:ignore>
<img src="{{ asset('static-image.jpg') }}" class="img-fluid">
</div>
Version Locking:
composer why splittlogic/fw to identify locked versions.Bootstrap JS Conflicts:
resources/js/app.js:
import 'bootstrap';
// Other libraries...
Livewire + Bootstrap Forms:
is-invalid) may conflict with Livewire’s built-in validation.wire:model.error for styling:
<input wire:model="email" class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}">
Asset Pathing:
config/fw.php match your public/ directory structure.mix() helper for asset paths:
'asset_path' => mix('fw/js/custom.js'),
Debugging:
php artisan livewire:discover to regenerate component classes.npm run dev or npm run build) if styles don’t apply.Livewire Component Issues:
config/fw.php:
'livewire' => [
'debug' => true,
],
Bootstrap Styling Problems:
data-bs-theme attributes).resources/sass/fw/_custom.scss:
@import "bootstrap/scss/bootstrap";
@import "fw/_variables"; // Override after import
Package-Specific Quirks:
@fwComponent), check the FwServiceProvider for registrations:
Blade::directive('fwComponent', function ($expression) {
return "<?php echo Splittlogic\Fw\Blade::component($expression); ?>";
});
Custom Livewire Components:
class ExtendedAlertComponent extends \Splittlogic\Fw\Components\AlertComponent
{
public function render()
{
$this->message = "Extended: " . parent::getMessage();
return view('livewire.extended-alert')->layout('layouts.app');
}
}
Bootstrap Theming:
resources/sass/fw/_theme.scss:
$theme-colors: (
"primary": #0d6efd,
"secondary": #6c757d
);
@import "bootstrap/scss/bootstrap";
Livewire Hooks:
mount(), hydrate()) for package-specific logic:
public function mount()
{
$this->initializeFwDefaults();
}
Service Provider Extensions:
AppServiceProvider:
public function register()
{
$this->app->bind(
\Splittlogic\Fw\Contracts\FwInterface::class,
\App\Services\CustomFwService::class
How can I help you explore Laravel packages today?