@gaplos.com
| Crafting the next-gen Laravel boilerplate using DDD (95%+ coverage) | Turning curiosity into code | Open for work 🚀
Most tests need:
❌ User::factory()->create()
✅ User::create(['email' => '[email protected]'])
Save factories for:
* Database seeding
* Complex relationships
* Random data generation
Be explicit. Be clear 📝
#Laravel
Most tests need:
❌ User::factory()->create()
✅ User::create(['email' => '[email protected]'])
Save factories for:
* Database seeding
* Complex relationships
* Random data generation
Be explicit. Be clear 📝
#Laravel
Good static use:
✅ Math::round()
✅ Str::slug()
✅ Carbon::parse()
✅ Validator::make()
Bad static use:
❌ DB::query()
❌ Cache::get()
Context matters. Stop the dogma 🎯
#PHP
Good static use:
✅ Math::round()
✅ Str::slug()
✅ Carbon::parse()
✅ Validator::make()
Bad static use:
❌ DB::query()
❌ Cache::get()
Context matters. Stop the dogma 🎯
#PHP
Problems:
❌ Cannot mock for tests
❌ Global state
❌ Hidden dependencies
❌ Hard to maintainUse Dependency Injection instead ✅
#PHP
Problems:
❌ Cannot mock for tests
❌ Global state
❌ Hidden dependencies
❌ Hard to maintainUse Dependency Injection instead ✅
#PHP
Perfect for:
✅ Dynamic object instantiation
✅ Mockable for testing
✅ Type-based creation
✅ Centralized logic
One factory, many objects 🚀
#PHP
Perfect for:
✅ Dynamic object instantiation
✅ Mockable for testing
✅ Type-based creation
✅ Centralized logic
One factory, many objects 🚀
#PHP
Perfect for:
✅ Mass data operations
✅ Expensive object creation
✅ Bulk record generation
✅ Pre-configured templatesClone it, don't build it 🚀
#PHP
Perfect for:
✅ Mass data operations
✅ Expensive object creation
✅ Bulk record generation
✅ Pre-configured templatesClone it, don't build it 🚀
#PHP
Perfect for:
✅ Database connections
✅ HTTP clients
✅ Expensive resources
✅ High-frequency operations
Reuse, don't recreate 🚀
#PHP
Perfect for:
✅ Database connections
✅ HTTP clients
✅ Expensive resources
✅ High-frequency operations
Reuse, don't recreate 🚀
#PHP
Perfect for:
✅ Multiple logger destinations
✅ Testable with mock factories
✅ Database/file/cloud storage
✅ Zero client code changes
SOLID principles in action 💪
#PHP
Perfect for:
✅ Multiple logger destinations
✅ Testable with mock factories
✅ Database/file/cloud storage
✅ Zero client code changes
SOLID principles in action 💪
#PHP
✅ Complex object assembly
✅ Multiple object variations
✅ Step-by-step construction
✅ Avoiding parameter overloadClean, flexible, maintainable 💪
#PHP
✅ Complex object assembly
✅ Multiple object variations
✅ Step-by-step construction
✅ Avoiding parameter overloadClean, flexible, maintainable 💪
#PHP
Perfect for:
✅ Multi-platform apps (Windows/Unix/Mac)
✅ Swappable export formats (CSV/JSON/XML)
✅ Theme systems (Dark/Light)
✅ Test mocking without refactoring
One interface, unlimited implementations 🚀
#PHP
Perfect for:
✅ Multi-platform apps (Windows/Unix/Mac)
✅ Swappable export formats (CSV/JSON/XML)
✅ Theme systems (Dark/Light)
✅ Test mocking without refactoring
One interface, unlimited implementations 🚀
#PHP
Perfect for:
✅ Less cognitive load
✅ Obvious happy path
✅ Fail fast, win clear
✅ Reads like a checklist
Guard clauses > pyramids of doom 🛡️
#laravel
Perfect for:
✅ Less cognitive load
✅ Obvious happy path
✅ Fail fast, win clear
✅ Reads like a checklist
Guard clauses > pyramids of doom 🛡️
#laravel
Perfect for:
✅ Less constructor boilerplate
✅ Clean match expressions
✅ Arrow function callbacks
✅ Self-documenting calls
Modern PHP is clean 🚀
#laravel
Perfect for:
✅ Less constructor boilerplate
✅ Clean match expressions
✅ Arrow function callbacks
✅ Self-documenting calls
Modern PHP is clean 🚀
#laravel
Perfect for:
✅ Keep fluent chains flowing
✅ Debug mid-chain easily
✅ Side effects, no breaks
✅ Natural top-to-bottom code
The chain never breaks 🔗
#laravel
Perfect for:
✅ Keep fluent chains flowing
✅ Debug mid-chain easily
✅ Side effects, no breaks
✅ Natural top-to-bottom code
The chain never breaks 🔗
#laravel
Perfect for:
✅ Handle millions of records
✅ Right tool for the job
✅ Safe updates while iterating
✅ Chain methods on big data
Memory matters 🧠
#laravel
Perfect for:
✅ Handle millions of records
✅ Right tool for the job
✅ Safe updates while iterating
✅ Chain methods on big data
Memory matters 🧠
#laravel
Why would someone prefer Laravel Nova over Filament PHP? Especially when you consider that Laravel Nova is a paid option. 🤔
#laravel
Why would someone prefer Laravel Nova over Filament PHP? Especially when you consider that Laravel Nova is a paid option. 🤔
#laravel
Perfect for:
✅ Apply constraint to many columns
✅ No repetitive chains
✅ Clean content filtering
✅ Matches your intent
One method beats ten 🎯
#laravel
Perfect for:
✅ Apply constraint to many columns
✅ No repetitive chains
✅ Clean content filtering
✅ Matches your intent
One method beats ten 🎯
#laravel
Perfect for:
✅ Conditional clauses, no chain breaks
✅ Clean search filter handling
✅ No nested if-blocks
✅ Default behavior with else
Keep the chain flowing 🌊
#laravel
Perfect for:
✅ Conditional clauses, no chain breaks
✅ Clean search filter handling
✅ No nested if-blocks
✅ Default behavior with else
Keep the chain flowing 🌊
#laravel
Perfect for:
✅ Call methods without closures
✅ Cleaner transformation chains
✅ Less boilerplate code
✅ Readable nested access
One line beats five 📐
#laravel
Perfect for:
✅ Call methods without closures
✅ Cleaner transformation chains
✅ Less boilerplate code
✅ Readable nested access
One line beats five 📐
#laravel
Perfect for:
✅ Respect API rate limits
✅ Prevent service overload
✅ Per-user throttling
✅ No more 429 errors
Background work, under control 🎛️
#laravel
Perfect for:
✅ Respect API rate limits
✅ Prevent service overload
✅ Per-user throttling
✅ No more 429 errors
Background work, under control 🎛️
#laravel
Perfect for:
✅ Rich value objects
✅ Auto encrypt/decrypt
✅ No manual transformation
✅ Encapsulated domain logic
Work with objects, store as JSON 🔄
#laravel
Perfect for:
✅ Rich value objects
✅ Auto encrypt/decrypt
✅ No manual transformation
✅ Encapsulated domain logic
Work with objects, store as JSON 🔄
#laravel
Perfect for:
✅ Centralized event handling
✅ Clean, focused models
✅ Auto-sync across systems
✅ Isolated testing
One observer beats 50 callbacks 🎯
#laravel
Perfect for:
✅ Centralized event handling
✅ Clean, focused models
✅ Auto-sync across systems
✅ Isolated testing
One observer beats 50 callbacks 🎯
#laravel
Perfect for:
✅ Protecting against abuse
✅ Tiered access (free vs paid)
✅ Custom limit segmentation
✅ Fair resource allocation
Stop bleeding infrastructure costs 💸
#laravel
Perfect for:
✅ Protecting against abuse
✅ Tiered access (free vs paid)
✅ Custom limit segmentation
✅ Fair resource allocation
Stop bleeding infrastructure costs 💸
#laravel
Perfect for:
✅ Multi-pass processing
✅ Dashboard aggregations
✅ Complex reports
✅ Data transformations
Laravel's remember() caches lazy collection results 💾
#laravel
Perfect for:
✅ Multi-pass processing
✅ Dashboard aggregations
✅ Complex reports
✅ Data transformations
Laravel's remember() caches lazy collection results 💾
#laravel
Perfect for:
✅ Authentication checks
✅ Password comparisons
✅ Cryptographic operations
✅ API key validations
Laravel's Timebox ensures constant execution time 🛡️
#laravel
Perfect for:
✅ Authentication checks
✅ Password comparisons
✅ Cryptographic operations
✅ API key validations
Laravel's Timebox ensures constant execution time 🛡️
#laravel
Perfect for:
✅ Data recovery
✅ Audit trails
✅ Trash features
✅ Compliance needs
Records stay in the database, just hidden 🔒
#laravel
Perfect for:
✅ Data recovery
✅ Audit trails
✅ Trash features
✅ Compliance needs
Records stay in the database, just hidden 🔒
#laravel