Kristopher Wilson has a quick post talking about how he thinks you can use interfaces effectively in PHP applications.
Yesterday, a question appeared on Reddit about the purpose of interfaces in PHP. While I was too late to the party to provide an answer to that thread (at least that would get noticed by anybody), I thought it was a great topic of conversation. So let's take a look at interfaces in PHP.
He introduces some of the basics around interfaces and provides some sample code showing how they're created and used (and extended). He talks about some good practices for implementing them in your classes and how this fits into the world of dependency injection. He also includes a bit about type hinting based on the interface implemented and how they can be seen as "contracts" in your code.
Link: http://kristopherwilson.com/2015/03/26/using-interfaces-effectively-in-php/
没有评论:
发表评论