Understanding Laravel’s macroable trait
Nicola Malizia wrote a short blog post on how Laravel’s handy Macroable trait can be used and how it works under the hood.
If you check the Laravel codebase I’m sure that you can observe that Laravel makes use of traits.There is one trait in the source code that pulls my attention. I’m talking about the Macroable trait.
The purpose of this trait is to extend (not in an OOP sense) a class at run-time. This way, you can add behavior without editing the original class source code.
Freek Van der Herten
Freek Van der Herten is a partner and developer at Spatie , an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modernphp and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band .
本文开发（php）相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师