PHP has the worst reputation-to-quality ratio in modern programming. Yes, the PHP of 2010 was chaotic — but PHP 8.3+, written with strict types, modern OOP patterns, and the Laravel or Symfony ecosystem, is a genuinely good language for web backends. The misconceptions are persistent because the internet is full of decade-old PHP criticism and decade-old PHP tutorials, so learning PHP in 2026 starts with choosing the right sources.
What changed in 2026
- PHP 8.3+: readonly classes, typed class constants, deep clone semantics, and a significantly improved JIT.
- Laravel 11: slimmed-down application skeleton, Folio for file-based routing, Volt for single-file Livewire components, Reverb for first-party WebSockets.
- Pest 3: test framework with architecture testing, parallel runs, and a snapshot testing feature that rivals Jest.
- FrankenPHP: a PHP server built on Caddy that handles worker mode (persistent PHP processes), HTTP/3, and push — replaces PHP-FPM for new deployments.
- PHP Fibers (8.1+) have ecosystem adoption: async frameworks like ReactPHP and Amp use them for event-loop concurrency without blocking.
What PHP actually is
PHP is a dynamically typed (but optionally strictly typed) scripting language designed for web development. It runs server-side, processes HTTP requests, and can output HTML, JSON, or any other format. It has a massive standard library, decades of documentation, and the largest web deployment footprint of any language.
Modern PHP has: namespaces, interfaces, traits, generics-like templates (via PHPDoc and Psalm/PHPStan), enums, match expressions, arrow functions, and a type system that covers ~90% of Java's expressiveness when you opt in.
The learning path
Phase 1 — Language fundamentals (weeks 1–2)
- Install PHP 8.3+ via Homebrew (macOS) or apt (Linux). Use
php -a for an interactive REPL.
- Read php.net/manual — it is the best-maintained language reference in the web-dev world, with user-contributed examples.
- Focus on: variables/types, arrays (PHP arrays are ordered maps), functions, OOP (classes, interfaces, traits, abstract classes), match expressions, null coalescing.
<?php
declare(strict_types=1);
// Enums (PHP 8.1+)
enum Status: string {
case Active = 'active';
case Inactive = 'inactive';
}
// Named arguments + union types
function formatName(string $first, string $last, bool $reverse = false): string {
return $reverse ? "$last, $first" : "$first $last";
}
echo formatName(last: 'Turing', first: 'Alan'); // Alan Turing
// Match expression — exhaustive, no fall-through
$label = match($status) {
Status::Active => 'Online',
Status::Inactive => 'Offline',
};
Phase 2 — Composer + ecosystem (week 2)
# Install Composer (getcomposer.org)
composer init
composer require guzzlehttp/guzzle
composer require --dev pestphp/pest phpstan/phpstan
Key Composer concepts: composer.json, autoload (PSR-4), vendor/, composer.lock, semantic versioning constraints.
Phase 3 — Laravel 11 (weeks 3–7)
composer create-project laravel/laravel myapp
cd myapp
php artisan serve
Core topics in order:
- Routing — routes/web.php, route parameters, named routes
- Controllers — resource controllers, form requests, validation
- Eloquent ORM — models, migrations, relationships, query builder
- Blade templates — layouts, components, directives
- Authentication — Laravel Breeze (starter kit) or Jetstream
- Queues — dispatching jobs, workers, retries (Horizon for Redis, Pulse for metrics)
// Eloquent model with relationship
class Post extends Model {
protected $fillable = ['title', 'body', 'user_id'];
public function user(): BelongsTo {
return $this->belongsTo(User::class);
}
public function scopePublished(Builder $query): void {
$query->whereNotNull('published_at');
}
}
// Usage
$posts = Post::published()->with('user')->latest()->paginate(20);
PHP framework comparison 2026
| Framework |
Best for |
Maturity |
| Laravel 11 |
Full-stack web apps, APIs, SaaS |
Very mature, largest ecosystem |
| Symfony 7 |
Enterprise, complex domain logic |
Battle-tested, higher learning curve |
| Slim 4 |
Minimal APIs, microservices |
Stable, minimal |
| WordPress (block themes) |
Content sites, client work |
Dominant CMS, separate learning path |
| Craft CMS |
Structured content, agencies |
Mature, developer-friendly |
Best resources in 2026
| Resource |
Format |
Best for |
| php.net/manual |
Docs |
Language reference |
| laracasts.com (Jeffrey Way) |
Screencasts |
Laravel learning path |
| "PHP 8 Objects, Patterns, Practice" |
Book |
OOP and design patterns |
| pestphp.com docs |
Docs |
Testing |
| PHPStan docs (phpstan.org) |
Docs |
Static analysis |
How to pick your first project
- Blog/CMS with Laravel — Eloquent, authentication, file uploads, SEO-friendly slugs.
- REST API — Laravel API resources, Sanctum auth, rate limiting, API versioning.
- WordPress plugin — Learn the WordPress hook system; valuable for client work.
Common mistakes
Skipping declare(strict_types=1). Without strict types, PHP silently coerces "123abc" to 123. Enable strict types in every file from day one.
Using global $_GET/$_POST directly. Laravel's Request object, form requests, and validation sanitize and validate input properly. Raw superglobals are an injection risk.
N+1 queries with Eloquent. Same as every ORM — use with() for eager loading. Laravel Debugbar or Telescope shows N+1s in dev.
Not using a static analyser. PHP's dynamic typing means bugs hide until runtime. PHPStan or Psalm at the highest level you can maintain is essential.
Ignoring queues. Sending email, processing uploads, or calling third-party APIs in the HTTP request cycle will kill performance. Everything slow goes on a queue.
What to skip
- Procedural PHP (no classes, no autoloading) — only for understanding legacy code, not for writing new code.
mysql_* functions — removed in PHP 7; PDO or an ORM only.
- CodeIgniter / CakePHP for new projects — both have declined; Laravel has won the framework market.
- XAMPP/WAMP — use Laravel Sail (Docker-based) or Herd (native macOS) for local dev.
FAQ
Is PHP worth learning when Node.js and Python exist?
Yes. PHP has the largest web deployment footprint, a huge job market (especially WordPress, Laravel, e-commerce), and modern PHP is competitive in productivity. The "PHP is dead" narrative has been wrong for 15 years.
PHP or Python for backend web dev?
Python wins for data-adjacent or AI-integrated backends. PHP wins for straightforward web apps and CMS work. Laravel's developer experience is competitive with Django.
How is PHP's performance in 2026?
PHP 8.x with OPcache and FrankenPHP worker mode handles tens of thousands of requests/second. It is not a performance bottleneck for most web applications.
What about type safety?
With declare(strict_types=1), typed properties, and PHPStan at level 9, PHP's type safety is comparable to TypeScript. It is opt-in, but the tooling is mature.
Where to go next