Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kristopher Wilson:
Using Interfaces Effectively in PHP
Mar 27, 2015 @ 15:12:32

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.

tagged: using interface contract introduction example extend

Link: http://kristopherwilson.com/2015/03/26/using-interfaces-effectively-in-php/


Trending Topics: