make-dev/orca-harpoon
Visual tool to inspect any HTML element and scaffold a Livewire component with one click. Generates the PHP class, Blade view, and Livewire registration, plus an AI refactor prompt to replace the original markup with an @livewire() tag.
Installation:
composer require make-dev/orca-harpoon
No additional configuration is required—middleware auto-injects the tool into local development.
First Use Case:
Where to Look First:
app/Livewire/[ComponentName].php (PHP class)resources/views/livewire/[component-name].blade.php (Blade view)app/Providers/AppServiceProvider.php (auto-registered via HarpoonServiceProvider).Visual Selection:
Component Naming:
UserAvatar, TaskQueue) for consistency with Livewire conventions.Component—use semantic names tied to functionality.Post-Scaffolding Integration:
@livewire('ComponentName') in your Blade template.State Management:
$data properties to bind form inputs or dynamic content.// Generated Livewire class
public $name = '';
public $isActive = false;
Styling and Assets:
<style> block for scoped CSS. Move critical styles to a separate file (e.g., resources/css/livewire/[component-name].css) for maintainability.@vite(['resources/css/livewire/*.css']) in your main layout to bundle them.Reusability:
@livewire('ComponentName', ['prop1' => $value]).PaginationControls component and reuse it across paginated lists.Nested Components:
DashboardSidebar containing SidebarItem components).wire:model or wire:click for parent-child interactions.Dynamic Components:
@component directive to render Livewire components conditionally:
@component('livewire.task-queue', ['tasks' => $tasks])
@endcomponent
Testing:
Livewire::test() to assert component behavior:
public function test_component_renders()
{
Livewire::test('TaskQueue')
->assertSee('Pending Tasks');
}
Middleware Scope:
app/Http/Kernel.php:
protected $middlewareGroups = [
'web' => [
// ... other middleware
\MakeDev\OrcaHarpoon\Http\Middleware\HarpoonMiddleware::class, // Remove or wrap in `if (app()->environment('local'))`
],
];
Element Selection Quirks:
Generated Code Overrides:
HarpoonServiceProvider in AppServiceProvider. If you manually register Livewire components, conflicts may arise. Solution: Merge registrations or disable auto-registration via config:
'harpoon' => [
'auto_register' => false,
],
AI Refactor Dependencies:
@livewire().Livewire Version Mismatch:
wire:model.live) may fail. Solution: Downgrade or manually adjust the component.Inspect Generated Code:
storage/logs/laravel.log for harpoon-related errors (e.g., duplicate component names).php artisan harpoon:clear-cache to reset cached selections.Component Not Updating?:
TaskQueue → resources/views/livewire/task-queue.blade.php).AppServiceProvider:
HarpoonServiceProvider::registerLivewireComponents();
Styling Issues:
!important sparingly; prefer BEM or utility classes.Custom Templates:
php artisan vendor:publish --provider="MakeDev\OrcaHarpoon\OrcaHarpoonServiceProvider" --tag="harpoon-views"
resources/views/vendor/orca-harpoon/livewire.blade.php.Pre/Post-Generation Hooks:
harpoon.generated event in EventServiceProvider:
public function boot()
{
event(new \MakeDev\OrcaHarpoon\Events\ComponentGenerated('TaskQueue'));
}
Element Filters:
allowedSelectors config:
'harpoon' => [
'allowed_selectors' => [
'div.card',
'form.*.form',
'section.widget',
],
],
Livewire Props Validation:
ComponentGenerated event:
public function handleComponentGenerated($event)
{
$event->component->rules([
'name' => 'required|min:3',
]);
}
How can I help you explore Laravel packages today?