PHP Traits: What They Are and When to Use Them
A practical look at PHP traits: why they exist and how to share behavior across unrelated classes without the pitfalls of multiple inheritance.
Category
Features, syntax and practices of the PHP, JavaScript, TypeScript, Go and Python languages. (Page 3/9)
This category has 49 posts.
A practical look at PHP traits: why they exist and how to share behavior across unrelated classes without the pitfalls of multiple inheritance.
A look at readonly classes, DNF types, and standalone type declarations in PHP 8.2, and their impact on domain modeling.
Why naming is not merely a style choice, but a design decision in its own right — patterns I have observed over the years.
How to carry your type contract from the backend API to the frontend interface without breaking it — and the practical approaches to get there.
How to move manual workflows into reliable Python scripts: which tasks are worth scripting and how to do it right.
Embedding meaning into code instead of relying on primitives: why and how to design value objects in PHP.