Why PHP in 2026?という素敵なサイトがあったので紹介するよ。
Why PHP in 2026?
実は、今のPHPは驚くほど優れています。
PHPは大きく進化しました。
モダンPHPには、JIT・イミュータブル・ENUM・アトリビュート・そしてTypeScriptに匹敵する型システムなど、なんでも揃っています。
ビルドも、トランスパイルも、バンドルも不要。
コードを書いてデプロイするだけ。
これこそが、誰もが忘れ去ってしまったパワーです。
Value Object
final readonly class Book
{
public function __construct(
public Status $status,
public string $title,
) {}
public function label(): string
{
return match ($this->status) {
Status::Draft => 'Working on it',
Status::Published => 'Ready to read',
};
}
}
API
Route::get('/books', function () {
return Book::query()
->where('status', Status::Published)
->with('author')
->paginate();
});
Testing
it('publishes a book', function () {
$book = Book::factory()->create();
$book->publish();
expect($book->status)->toBe(Status::Published);
});
Generics
/** @return array<int, string> */
public function titles(): array
{
return Book::all()
->filter(fn (Book $book): bool => $book->isPublished())
->map(fn (Book $book): string => $book->title)
->toArray();
}
Ecosystem
最新のPHPは、単に優れているだけではありません。
昔のPHPとは全くの別物です。
Laravel
$ laravel new myapp
_ _
| | | |
| | __ _ _ __ __ ___ _____| |
| | / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V / __/ |
|______\__,_|_| \__,_| \_/ \___|_|
Creating a laravel/laravel project...
✓ Application ready in [myapp].
✓ Built with love.
Symfony
$ symfony new myapp
* Creating a new Symfony project with Composer
* Setting up the project under Git version control
(running git init /Projects/myapp)
[OK] Your project is now ready in /Projects/myapp
Composer
$ composer require laravel/sanctum
./composer.json has been updated
Running composer update laravel/sanctum
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking laravel/sanctum (v4.0.6)
✓ Package laravel/sanctum installed successfully
PHPStan
$ ./vendor/bin/phpstan analyse
42/42 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
───────────────────────────────────────────────────
[OK] No errors
💡 Tip: PHPStan is at level 9 — maximum strictness
Pest
$ ./vendor/bin/pest
PEST v4.0
✓ it can create a book 0.02s
✓ it can publish a book 0.01s
✓ it validates required fields 0.01s
✓ it belongs to an author 0.02s
Tests: 4 passed (12 assertions)
Duration: 0.06s
PHPUnit
$ ./vendor/bin/phpunit --testdox
PHPUnit 12.5.4 by Sebastian Bergmann and contributors.
Book (VendorAppTestsUnitDomainModelBook)
✓ it can create a book
✓ it can publish a book
✓ it validates required fields
✓ it belongs to an author
Tests: 4, Assertions: 12, Skipped: 0
Pint
$ ./vendor/bin/pint
PINT v1.18
✓ app/Models/Book.php fixed
✓ app/Http/Controllers/BookController.php fixed
✓ tests/Feature/BookTest.php fixed
3 files fixed
Rector
$ ./vendor/bin/rector --dry-run
12/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
3 files would have been changed:
↳ AddVoidReturnTypeWhereNoReturnRector
↳ ReadOnlyClassRector
↳ TypedPropertyFromStrictConstructorRector
[OK] Rector is done! 3 files with changes
Ready to see modern PHP?
モダンPHPに飛び込む準備はできましたか?
・型安全。
・豊かな表現力。
・モダン。
・とりあえず動く。
動画をご覧ください。
Start Today
今すぐ始める。
macOS
/bin/bash -c "$(curl -fsSL https://php.new/install/mac)"
Windows
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows'))
Linux
/bin/bash -c "$(curl -fsSL https://php.new/install/linux)"
Create a Laravel app and run it
プロジェクトの作成と実行。
laravel new my-app
cd my-app
composer run dev # visit http://localhost:8000
Show Your Support
バッジをREADMEに追加しよう!
マークダウン。
[](https://whyphp.dev)
HTML。
<a href="https://whyphp.dev"><img src="https://img.shields.io/badge/Why_PHP-in_2026-7A86E8?style=flat-square&labelColor=18181b" alt="Why PHP in 2026"></a>
感想
元サイトはデザインも見た目も凝っててたいへんよいので見に行きましょう。
20年前の知識で止まっている人には大変悪いのですが、現在のPHPは、手続き型もオブジェクト指向も関数型もなんでもできるマルチパラダイム言語に変貌しつつあります。
速度もPHP5時代とは比べものにならないほど上昇し、もちろんコンパイル言語とは比較になりませんが、スクリプト言語としては相当に頑張っているレベルです。
さあさっそく今日からPHPを使い始めましょう。
