[php-src] Issue #21508: Rethink PHP's Evolution Direction – Focus on Pragmatism, Not Java-like Complexity
[email protected] (Qfix)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/21508
Author: Qfix
### Description
### Summary
PHP has become increasingly complex with features like typed properties, constructor property promotion, attributes, and the upcoming property hooks. While these features have their merits, they steer PHP toward a "Java-like" enterprise language, losing its original simplicity and pragmatic nature. I propose PHP should refocus on what made it great: simplicity, web-native performance, and developer productivity, with a stronger emphasis on concurrency and practical language improvements.
---
### Problem Statement
**PHP is losing its identity.**
Since PHP 7 and especially PHP 8, the language has been adding "enterprise features" that:
- Increase learning curve for new developers
- Make code more verbose without solving real web problems
- Imitate Java without achieving Java's type system completeness
- Neglect the needs of 80% of PHP users (web developers)
**Current pain points:**
1. **Half-hearted type system** – It's not truly strong (automatic type juggling still exists), nor truly dynamic. It adds complexity without full benefits.
2. **Missing concurrency** – PHP still relies on third-party extensions (Swoole, ReactPHP) for async/parallel processing, while Go and Node.js have native solutions.
3. **Lack of practical helpers** – Basic array operations still require verbose code.
4. **Complex features for minority** – Attributes, property hooks, and enums are rarely used in typical web development but increase cognitive load.
---
### Proposed Solution
Instead of chasing Java, PHP should embrace its identity as the **pragmatic web language** and focus on:
#### 1. Native Concurrency (Top Priority)
**Current:**
```php
// Need third-party extensions like Swoole
$server = new Swoole\Http\Server(...);
Proposed:
php
// Native async/await
$results = await([
http_get('https://api1.com'),
http_get('https://api2.com'),
http_get('https://api3.com'),
]);
// Native coroutines
go(function() {
$data = http_get('https://api.com');
return process($data);
});
Why: Node.js and Go are eating PHP's market share. Concurrency is the biggest missing piece.
2. Practical Built-in Functions
Current:
php
$names = array_values(array_filter($users, fn($u) => $u->active));
$first = count($names) > 0 ? $names[0] : null;
Proposed:
php
$names = array_pluck($users, 'name');
$names = array_where($users, fn($u) => $u->active);
$first = array_first($users);
$grouped = array_group_by($users, 'role');
$compact = array_compact($data); // remove null values
Why: PHP is a web language; array manipulation is 90% of what we do. Make it elegant.
Why This Matters
PHP's competitive advantages:
✅ Simplicity – easy to learn, fast to develop
✅ Web-native – built for HTTP
✅ Deployment – just upload files
✅ Ecosystem – WordPress, Laravel, Composer
What PHP is losing to competitors:
❌ Node.js: better concurrency, async by default
❌ Go: native concurrency, better performance
❌ Python: cleaner syntax, broader ecosystem
PHP should lean into its strengths and fix its weaknesses (concurrency, practicality), not mimic Java.
Conclusion
PHP is at a crossroads. It can:
Continue becoming a "Java-lite" – gaining complexity but never achieving Java's type safety or ecosystem
Lean into its strengths – simple, pragmatic, web-native, and fast
I strongly believe option 2 is the path forward. Please prioritize:
Native async/await/coroutines
Practical array helpers
Simplified syntax (not more complexity)
Let's keep PHP the language that gets things done – not the language that requires an enterprise architect.
Thank you for your time and for maintaining PHP. I'm happy to provide more examples or participate in discussions.