Every syntax. Every feature. One winner.
PHP frameworks have matured enormously over the past decade — and Laravel has long dominated the conversation. But a new challenger has entered: Doppar, built from the ground up for clarity, performance, and zero bloat.
This post does a deep, side-by-side comparison of both frameworks across real-world features — with actual code examples — so you can decide which one belongs in your next project.
Routing & Controllers
Laravel
// routes/web.php
Route::post('/user/store', [UserController::class, 'store'])
->middleware('auth');
// UserController.php
public function store(Request $request, UserRepositoryInterface $repo)
{
// $repo must be bound in a ServiceProvider elsewhere
}
Doppar
#[Route(uri: 'user/store', methods: ['POST'], middleware:['auth'])]
public function store(
#[Bind(UserRepository::class)] UserRepositoryInterface $userRepository,
Request $request
) {
// Binding is declared RIGHT HERE — no ServiceProvider needed
}
Doppar uses PHP 8 attributes to co-locate the route definition, middleware, and dependency bindings all in one place. There is no hidden magic, no separate route file to cross-reference, and no service provider to update.
Doppar’s #[Route] + #[Bind] combination is genuinely more expressive and self-documenting. Everything you need to understand a controller action is visible in one place.
Dependency Injection
Laravel
// AppServiceProvider.php
public function register(): void
{
$this->app->bind(UserRepositoryInterface::class, UserRepository::class);
$this->app->bind(PaymentInterface::class, StripePaymentService::class);
}
// Controller
public function checkout(
UserRepositoryInterface $users,
PaymentInterface $payment
) {
// bindings resolved from ServiceProvider
}
Laravel requires all interface-to-concrete bindings to be registered in a ServiceProvider. This is the established pattern, but it means navigating between multiple files to understand what gets injected where.
Doppar
#[Route(uri: 'checkout', methods: ['POST'])]
public function checkout(
#[Bind(UserRepository::class)] UserRepositoryInterface $users,
#[Bind(StripePaymentService::class)] PaymentInterface $payment,
Request $request
) {
$user = $users->find($request->user_id);
$payment->charge($user, $request->amount);
}
Doppar’s #[Bind] attribute resolves the binding inline at the injection point. No service provider. No separate config. Every dependency is visible exactly where it is consumed.
The inline #[Bind] is a paradigm shift. It eliminates the "where is this bound?" problem entirely. Doppar's DI is not just different — it is architecturally cleaner.
Request Handling & Input Processing
Laravel
public function store(Request $request)
{
$title = ucfirst(trim($request->input('title')));
$tags = is_string($request->input('tags'))
? explode(',', $request->input('tags'))
: $request->input('tags');
$slug = Str::slug($title);
abort_if(strlen($slug) === 0, 422, 'Invalid slug');
Post::create(compact('title', 'tags', 'slug'));
}
Laravel’s Request is a solid input carrier. But transformation, contextual derivation, and assertions require manual, imperative code spread across the controller.
Doppar
public function store(Request $request)
{
$data = $request
->pipeInputs([
'title' => fn($v) => ucfirst(trim($v)),
'tags' => fn($v) => is_string($v) ? explode(',', $v) : $v,
])
->contextual(fn($data) => [
'slug' => Str::slug($data['title']),
])
->ensure('slug', fn($slug) => strlen($slug) > 0)
->only('title', 'tags', 'slug');
Post::create($data);
}
Doppar’s Request is a full input processing pipeline. pipeInputs transforms raw values, contextual derives new fields from existing ones, ensure asserts conditions, and only extracts a clean payload — all in one fluent chain.
The request pipeline turns what is usually messy controller boilerplate into a clean, readable, composable flow. This alone can significantly reduce controller complexity in data-heavy applications.
Model Hooks / Observers
Laravel
// App\Observers\PostObserver.php
class PostObserver
{
public function creating(Post $post): void
{
$post->slug = Str::slug($post->title);
}
public function created(Post $post): void
{
Cache::forget('posts.all');
}
}
// AppServiceProvider.php — must register separately
Post::observe(PostObserver::class);
Laravel Observers are clean but require a separate class file AND a registration call in a ServiceProvider. The logic is disconnected from the model.
Doppar — Array Style
class Post extends Model
{
protected array $hooks = [
'before_created' => [self::class, 'generateSlug'],
'after_created' => [self::class, 'clearCache'],
'after_updated' => [
'handler' => AuditHook::class,
'when' => [self::class, 'shouldAudit'], // Conditional!
],
];
public static function generateSlug(Model $model): void
{
$model->slug = str()->slug($model->title);
}
public static function clearCache(Model $model): void
{
Cache::delete('posts.all');
Cache::delete('post.' . $model->id);
}
public static function shouldAudit(Model $model): bool
{
return $model->isDirtyAttr('title') || $model->isDirtyAttr('status');
}
}
Doppar — #[Hook] Attribute Style
use Phaseolies\Database\Entity\Attributes\Hook;
class Post extends Model
{
#[Hook('before_created')]
public function generateSlug(): void
{
$this->slug = str()->slug($this->title);
}
#[Hook('before_created')]
public function setDefaultStatus(): void
{
if (empty($this->status)) {
$this->status = 'draft';
}
}
#[Hook('after_created')]
public function notifySubscribers(): void
{
(new NotifySubscribersJob($this->id))->dispatch();
}
#[Hook('after_deleted')]
public function clearPostCache(): void
{
Cache::delete('post.' . $this->id);
}
}
Doppar supports three hook styles — inline array callbacks, class-based hook handlers, and PHP attribute hooks — all on the same model if needed. The when conditional is a standout feature: hooks fire only when your runtime condition returns true.
Laravel has no equivalent of the #[Hook] attribute, no $hooks array, and no built-in conditional when guard. Doppar's hook system is more flexible, more expressive, and more co-located than anything Laravel offers.
Task Scheduling & Cron
Laravel
// app/Console/Kernel.php
protected function schedule(Schedule $schedule): void
{
$schedule->command('emails:send')->hourly();
$schedule->job(new GenerateReports)->daily();
}
Then in your server’s crontab:
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
Laravel requires editing the server’s crontab and setting up Supervisor for daemon-like behavior. Any DevOps mistake and your jobs silently stop.
Doppar
# Standard mode
php pool cron:run
# Real-time daemon mode — NO crontab needed at all
php pool cron:run --daemon
# Fully managed native daemon
php pool cron:daemon start
php pool cron:daemon stop
php pool cron:daemon restart
php pool cron:daemon status
Doppar’s dual-mode scheduling engine runs either with a system cron OR as a self-managed background daemon. No Supervisor. No systemd. No crontab editing required. The framework manages PID tracking, SIGTERM/SIGINT handling, error recovery, and logging internally — and supports second-level task granularity, which crontab-based approaches can never achieve
Become a Medium member
Doppar eliminates DevOps complexity entirely. The same command works identically in local development, staging, and production — with zero server configuration.
Frozen Services
Laravel has no equivalent. Doppar’s #[Immutable] container feature enforces a strict lifecycle boundary — services are configurable during boot and permanently frozen at runtime. Mutation is caught at the object level, not by convention.
## Lifecycle Phases
| Phase | Description |
|--------------|-----------------------------------------------------------------------------|
| **Phase 1: Boot** | Configure from `config()`, `env()`, `database` — all writes allowed |
| **Phase 2: Freeze** | Container calls `freeze()` — properties are snapshotted and then locked |
| **Phase 3: Runtime** | Reads work transparently — any write throws `ImmutableViolationException` |
#[Immutable]
class PaymentService
{
use EnforcesImmutability;
public string $gateway = 'stripe';
public float $taxRate = 0.08;
}
// Service provider (boot window — writable)
$payment->taxRate = config('payment.tax_rate');
$this->app->singleton(PaymentService::class,
fn() => $payment);
// At runtime — frozen, reads work, writes throw
$payment->calculateTotal(100); // ✓ works
$payment->taxRate = 0.0;
// ✗ ImmutableViolationException:
// Cannot mutate $taxRate on [PaymentService]
Feature Comparison
| Feature | PHP readonly class | Laravel singleton | Doppar #[Immutable] |
|----------------------------------|--------------------------|---------------------|----------------------------------|
| Configure from config()/env() | ✗ Impossible post-new | ✗ Convention only | ✓ During boot window |
| Exception on mutation | Generic PHP Error | ✗ No exception | ✓ Typed ImmutableViolationException |
| Works with ServiceProvider boot | ✗ | ✓ | ✓ Designed for this |
| Enforced at object level | PHP engine | ✗ | ✓ via `__set()` |
Laravel has no mechanism to enforce service immutability after boot. Doppar turns a code-review guideline into a framework-level guarantee. An entire class of silent shared-state bugs simply cannot exist.
Temporal Time-Travel ORM
Laravel has no built-in audit history. Developers bolt on observers, third-party packages, or custom solutions. Doppar’s #[Temporal] attribute gives every model a complete, queryable time machine — activated by one line.
Laravel — manual observer approach
// App\Observers\ContractObserver.php
class ContractObserver
{
public function updated(Contract $c): void
{
AuditLog::create([
'model' => Contract::class,
'record' => $c->id,
'before' => $c->getOriginal(),
'after' => $c->toArray(),
'changed' => $c->getDirty(),
]);
}
}
// AppServiceProvider — register separately
Contract::observe(ContractObserver::class);
// Repeat for every model. Maintain forever.
Doppar — one attribute, everything works
#[Temporal]
class Contract extends Model
{
protected $creatable = [
'title', 'status', 'amount', 'client_id'
];
}
// Run once — creates contracts_history table
// php pool migrate:temporal
// Your controllers don't change at all.
// History accumulates automatically.
The complete Time-Travel API — all from one attribute:
Time-travel query — any point in time
// What did contract 42 look like on Jan 1?
$contract = Contract::at('2024-01-01')
->find(42);
echo $contract->status; // 'draft'
echo $contract->amount; // 5000
// Collections too — same fluent API
$actives = Contract::at('2024-06-01')
->where('status', 'active')
->orderBy('amount', 'DESC')
->get();
Diff, rewind, restore
$contract = Contract::find(42);
// Structured diff between two dates
$diff = $contract->diff('2024-01-01', '2024-06-01');
// ['changes' => ['status' => ['from'=>'draft', 'to'=>'active']]]
// Read-only historical instance
$old = $contract->rewindTo('2024-01-01');
echo $old->status; // 'draft' — live record untouched
// Roll back and persist (recorded in history)
$contract->restoreTo('2024-01-01');
Laravel offers no built-in temporal capability. The standard approach (a model observer writing to an audit table) requires a separate file, separate registration, and must be maintained for every model.
Doppar’s #[Temporal] activates the entire feature — history table, lifecycle hooks, time-travel queries, diff engine, rewind, restore, and actor tracking — with one attribute and one command.
Observable Model Properties
Laravel gives you model-level events. You hook into aftersave(), then manually check which column changed, compare old vs new, and conditionally run logic. It works but it doesn’t scale cleanly.
Doppar went a level deeper. With #[Watches], you declare reactive watchers directly on the property itself:
#[Watches(OrderStatusChanged::class)]
protected $status;
#[Watches(TriggerFraudReview::class, when: FraudThreshold::class)]
protected $total;
The moment $order->status changes and hits the database — your watcher fires automatically with the old value, the new value, and the full model instance. No manual dirty checks. No scattered if-statements. The attribute is the contract.
What makes it stand out:
Property-level — not table-level, not lifecycle-level. Exactly the column that changed.
Conditional — attach a model method or a dedicated condition class. Watcher only fires when it should.
DI-resolved — watchers and conditions are resolved from the container. Full dependency injection, fully testable.
Repeatable — stack multiple #[Watches] on one property. Each evaluated independently.
Zero overhead — reflection runs once per class per process, result is cached. No cost for unwatched models.
Press enter or click to view image in full size
Doppar Benchmark Result
Doppar is engineered for speed from the ground up. Every repeated execution is intelligently memoized. Third-party dependencies are minimised — most features are built directly into the core.
Benchmark result: Doppar sustained 318+ requests per second with 1,000 concurrent users, a 100% success rate across 50,000 requests, and median response times below 3 seconds even under heavy database load.
That is 7–8× higher throughput than comparable Laravel benchmarks.
This is not a marginal improvement. A 7–8× throughput difference is architectural. If you are building high-traffic APIs, real-time applications, or cost-sensitive infrastructure, Doppar’s performance story is impossible to ignore.
Verdict
Laravel wins on ecosystem. If you need a massive community, years of Stack Overflow answers, thousands of packages, and battle-hardened production track record, Laravel remains the safest choice today. It has earned that position.
Doppar wins on almost everything technical. The inline #[Bind] DI, the #[Hook] attribute system, the fluent request pipeline, the native cron daemon, and the 7–8× performance advantage are not incremental improvements over Laravel — they are architectural leaps forward built on modern PHP 8 design principles.
The question is not which framework is better built — on technical merit, Doppar is genuinely impressive and outclasses Laravel in almost every head-to-head comparison. The question is whether your project needs a proven ecosystem or a performance-first, developer-experience-first architecture.
For greenfield projects in 2026? Give Doppar a serious look.
Try Doppar: doppar



Top comments (0)