Constructor Property Promotion (CPP) is one of the quiet revolutions of PHP 8.
It removes boilerplate and lets objects declare their shape directly in the constructor signature.
It reflects a broader shift in modern PHP:
objects should reveal their structure
without ceremony.
CPP lets us define and initialize properties directly in the constructor parameters:
class User { public function __construct( public string $id, public string $email, ) {} }
No separate property declarations.
No assignments inside the constructor.
No duplication.
Just the shape of the object, expressed cleanly.
Constructor Property Promotion reduces:
It makes objects easier to read, easier to reason about,
and easier for AI to generate correctly.
CPP is structural shorthand.
It doesn’t change what the object is.
It simply removes the ceremony around declaring it.
The key idea:
If the constructor is doing real work — validating input, enforcing invariants, preparing state, or coordinating behavior — CPP may not be the right fit.
Promotion is for expressing structure, not for hiding logic.
Without CPP:
class Point { public float $x; public float $y; public function __construct(float $x, float $y) { $this->x = $x; $this->y = $y; } }
With CPP:
class Point { public function __construct( public float $x, public float $y, ) {} }
Same meaning.
Less noise.
More clarity.
Use CPP when:
CPP shines in DTOs, request models, value objects, and small domain primitives.
Avoid CPP when:
CPP is for shape, not behavior.
AI often uses CPP everywhere, even when the constructor contains logic or invariants. Sometimes it mixes CPP with manual property declarations, or promotes properties that should remain private.
Our mental model helps us see when CPP expresses the object’s shape — and when AI is using it simply to reduce typing.
Constructor Property Promotion lets objects declare their structure without ceremony.
It reduces duplication, clarifies intent, and makes the shape of the object visible.
Once we internalize this, we can immediately see when AI‑generated code:
CPP is a small feature
— but it teaches us how modern PHP wants to express structure with clarity and intention.