DEV Community

Discussion on: How to Use PHP Traits

paulthebaud profile image
Paul Thébaud

I don't know Vue JS mixins, but about PHP, here is my opinion :
Traits are not a bad practice, but they must be used carefully. I mean, you can use them for several things (I think about the RefreshDatabase trait in Laravel testing env), but it is not a good practice to use them to add property in your class (such as adding a name on your class Person for exemple).