A Practical Introduction to Laravel × DDD × Clean Architecture
No Laravel experience required. A 20-chapter guide for SPA developers (Vue/React) that explains Laravel as an API backend together with domain-driven design (DDD) and clean architecture, step by step. It covers the theory of value objects, entities, aggregates, and repositories, through to implementation patterns, transactions, testing, and authentication in a Laravel project.
Basics of Laravel API Development — Controller, FormRequest, Eloquent, DI
An introduction to API backend development for those new to Laravel. It covers routing, controllers, FormRequest, API Resource, Eloquent ORM, the DI container, Sanctum authentication, and the PHP 8.x syntax used in this book (readonly / enum / constructor promotion).
Eloquentモデルの責務 — 書いていい仕事と書くべきでない仕事
Eloquentモデルが本来担うべき責務(リレーション・アクセサ/ミューテタ・キャスト・ローカルスコープ)と、モデルに書くべきでない責務を、Fat Modelとの対比で整理します。
Entities — Domain Objects with an Identifier and a Lifecycle
Explains the DDD entity (Entity) with implementation examples of Order / OrderLine. It covers identity judgment by identifier, the difference from value objects, entity ≠ table, the two factory methods create() / reconstruct(), and state transitions and the encapsulation of business rules using enums.
Getting Started — Introduction to Laravel × DDD × Clean Architecture
An introduction to DDD and clean architecture with Laravel, aimed at developers experienced with SPA development (Vue/React). It covers who this guide is for, prerequisites, the 20-chapter structure, and an overview of DDD and clean architecture.
PHPクラス設計入門
PHP でクラス設計そのものを入門から実践まで学ぶ全14章のガイド。フレームワーク非依存の設計原則 (カプセル化・単一責任・継承とコンポジション・インターフェース・SOLID) から、Laravel でのモデル/サービスクラス設計まで一気通貫で扱います。
PHPのクラス基本文法
PHPにおけるクラスの基本文法。プロパティ・メソッド・コンストラクタ・可視性修飾子・readonly・コンストラクタプロモーション・enumを解説します。
Value Objects — Immutable Domain Objects That Encapsulate Business Rules
Explains the DDD value object (Value Object) with implementation examples such as Money / EmailAddress / ShippingAddress / OrderId. It summarizes their advantages over primitive types, the importance of immutability, and design guidelines for named constructors, validation, and equals().
インターフェースと抽象への依存
インターフェースによる契約に基づく設計と、依存性逆転の原則という考え方を解説します。
カプセル化と情報隠蔽
public propertyの危険性、tell-don't-ask原則、ゲッター・セッターの要否判断を解説します。
サービスクラスへの責務分割 — Controller肥大化を防ぐ切り出し
Controllerに残った複数の関心事を調整する処理を、サービスクラスへ切り出す判断基準を解説します。単なるファイル分割で終わらせないための凝集度の保ち方も扱います。
はじめに — なぜクラス設計を学ぶのか
PHPクラス設計入門連載の第1章。god classや変更に弱いコードの実例を通じて、クラス設計を学ぶ意味と連載全体の見通しを示します。
まとめ — 実務でクラス設計を判断するために
全13章の判断基準を、実務のコードに向き合うときに使えるチェックリストの形に整理します。次に読むガイドも紹介します。
例外設計とバリデーション — Form Requestとカスタム例外
Form Requestによるリクエストの形式チェックと、カスタム例外クラスによるfail-fastな設計を解説します。
依存性注入とLaravelのコンテナ — 自動解決とインターフェースの結び付け
Laravelのサービスコンテナによる自動解決の仕組みと、インターフェースと実装クラスをbindで結び付ける基本的な使い方を解説します。
凝集度・結合度とSOLID原則の総整理
第1部の集大成として、開放閉鎖・リスコフ置換・インターフェース分離の原則を補い、凝集度と結合度という物差しでこれまでの原則を振り返ります。
単一責任の原則
単一責任の原則とクラスを小さく保つ考え方。god classの兆候と、責務分割の実例を解説します。
実践 — クラス設計のリファクタリング
第8章のFat Controller/Fat Modelを、第9〜12章で見た判断基準を使って通しでリファクタリングします。第1部の原則を総動員する実践編です。
第2部の導入 — Fat Controller/Fat Modelとは何か
第2部の導入。Fat Controller/Fat Modelとは何かを整理し、本パートで扱う範囲(クラス設計止まり)を明示します。
継承とコンポジション
is-a・has-aの関係と、なぜ継承よりコンポジションが優先されるかを解説します。