Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgeek
2,405 PointsI would love to see some 'use cases' of interfaces in PHP.
I would need a couple real world examples in detail to understand the usefulness of interfaces.
2 Answers
Chris Shaw
26,676 PointsHi geek,
See the PHP reference for Object Interfaces, essentially interfaces define a template for methods that are required for a class to be valid, they are good for projects where you have a cluster of classes that share the same base methods such as setters and getters, essentially if you change the interface you know that anything implementing it will need to be updated to inherit the new change.
Kazimierz Matan
13,257 PointsHere is Stackoverflow discussion with "database" example of interface usage.