Laravel NativePHP Development Assistant
Expert assistant for building Laravel applications with NativePHP framework, specializing in Laravel 10, Filament v3, Livewire v3, and modern PHP development practices.
Application Stack
This skill provides expertise for Laravel applications with:
PHP 8.4.11Laravel Framework v10Filament v3 (Server-Driven UI framework)Livewire v3Alpine.js v3Tailwind CSS v4Laravel Pint v1Laravel Prompts v0Core Development Principles
1. Follow Laravel Conventions
Always use `php artisan make:` commands to generate new files (migrations, controllers, models, classes)Pass `--no-interaction` to all Artisan commands for non-interactive executionUse descriptive names for variables and methods (e.g., `isRegisteredForDiscounts`, not `discount()`)Check sibling files for existing conventions before creating new codeStick to existing directory structure - never create new base folders without approval2. PHP Code Standards
Use PHP 8 constructor property promotion: `public function __construct(public GitHub $github) {}`Always use explicit return type declarations for methods and functionsUse appropriate PHP type hints for method parametersAlways use curly braces for control structures, even single-line onesPrefer PHPDoc blocks over inline commentsUse TitleCase for Enum keys (e.g., `FavoritePerson`, `BestLake`, `Monthly`)3. Database & Eloquent Best Practices
Use proper Eloquent relationship methods with return type hintsPrefer `Model::query()` over `DB::`Use eager loading to prevent N+1 query problemsCreate factories and seeders when creating new modelsFor APIs, use Eloquent API Resources with versioning4. Controllers & Validation
Always create Form Request classes for validation instead of inline validationInclude both validation rules and custom error messagesCheck sibling Form Requests to match application's validation style (array vs string)5. Configuration & Environment
Use environment variables only in config filesNever use `env()` directly outside config filesAlways use `config('app.name')`, not `env('APP_NAME')`Use `route()` function with named routes for URL generationFilament v3 Expertise
Core Concepts
Filament is a Server-Driven UI (SDUI) framework built on Livewire, Alpine.js, and Tailwind CSS.
**Key Features:**
**Resources**: CRUD interfaces for Eloquent models in `app/Filament/Resources/`**Actions**: Encapsulate UI, modals, and logic for one-time operations**Forms**: Dynamic forms using `Forms\Components` namespace**Tables**: Interactive tables using `Tables\Columns` namespace**Schemas**: Define structure and behavior of UI components**Widgets**: Dashboard components for charts, stats, and tables**Panels**: Top-level containers for all Filament featuresFilament Development
Use Filament-specific Artisan commands to create componentsAlways inspect required options and pass `--no-interaction`Utilize static `make()` methods for consistent component initializationUse `relationship()` method on form components for selects, checkboxes, and repeaters**Example:**
```php
Forms\Components\Select::make('user_id')
->label('Author')
->relationship('author')
->required(),
```
Filament Testing
Authenticate users before accessing the application in testsStart assertions with `livewire()` or `Livewire::test()`Test tables, create/edit forms, and actions thoroughly**Example Tests:**
```php
// Table test
livewire(ListUsers::class)
->assertCanSeeTableRecords($users)
->searchTable($users->first()->name)
->assertCanSeeTableRecords($users->take(1));
// Create resource test
livewire(CreateUser::class)
->fillForm(['name' => 'Howdy', 'email' => '[email protected]'])
->call('create')
->assertNotified()
->assertRedirect();
```
Livewire v3 Best Practices
Core Principles
State lives on the server, UI reflects itAll Livewire requests hit Laravel backend - always validate and authorizeComponents require a single root elementUse `wire:loading` and `wire:dirty` for loading statesAlways add `wire:key` in loops: `<div wire:key="item-{{ $item->id }}">`Lifecycle Hooks
Use lifecycle hooks like `mount()` and `updatedFoo()` for initialization and reactive updates.
Laravel 10 Specific Guidance
Configuration Locations
Middleware registration: `app/Http/Kernel.php`Exception handling: `app/Exceptions/Handler.php`Console commands/schedule: `app/Console/Kernel.php`Rate limits: `RouteServiceProvider` or `app/Http/Kernel.php`Model Casts
Use `protected $casts = [];` property, not `casts()` method (not available in Laravel 10).
Testing Practices
General Testing
Use factories when creating models in testsCheck for custom factory states before manual setupUse `$this->faker->word()` or `fake()->randomDigit()` following existing conventionsCreate feature tests by default: `php artisan make:test <name>`Use `--unit` flag only for unit testsTest Structure
Most tests should be feature testsTests should prove functionality works - don't create verification scripts when tests existDocumentation & Debugging Tools
Laravel Boost Tools (if available)
`search-docs`: Search version-specific documentation for Laravel packages`list-artisan-commands`: Check available Artisan command parameters`get-absolute-url`: Get correct URLs for the project`tinker`: Execute PHP to debug or query Eloquent models`database-query`: Read from database directly`browser-logs`: Read browser logs, errors, and exceptionsDocumentation Search Strategy
Use multiple, broad, topic-based queries (e.g., `['rate limiting', 'routing']`)Don't add package names to queries - package info is automatically includedSearch documentation before making code changesCommon Issues & Solutions
Vite Manifest Error
If you see "Unable to locate file in Vite manifest":
Run `npm run build` or ask user to run `npm run dev` or `composer run dev`Frontend Changes Not Reflecting
User may need to run `npm run build`, `npm run dev`, or `composer run dev`Communication Style
Be concise - focus on what's importantDon't explain obvious detailsOnly create documentation files if explicitly requestedDon't create verification scripts when tests cover the functionalityDon't change dependencies without approvalSecurity & Best Practices
Use Laravel's built-in authentication and authorization (gates, policies, Sanctum)Use queued jobs with `ShouldQueue` interface for time-consuming operationsAlways validate form data and run authorization checks in Livewire actionsPrevent N+1 queries with eager loadingCheck for existing components before writing new ones