
- PHP
- Intermediate
About this Course
An interface is a type of contract that assures that certain abilities are available on on a particular object class. We'll write and extend multiple interfaces, then implement them to design and match functionality. Interfaces do not store any implementation details themselves. To share implementation details between classes, we harness the power of inheritance. Abstract classes prevent a parent class from being directly instantiated, while at the same time defining methods that MUST be implemented in any extending children.
This course will combine interface contracts with class hierarchy to leverage the benefits of each concept. We'll explain the differences between interfaces and abstract classes, and give you the knowledge you need to build and implement both in your own projects.
What you'll learn
- Writing an Interface
- Implementing Interfaces
- Extending Interfaces
- Matching Interfaces
- Abstract Classes
Introducing Interfaces
An interface is a type of contract that assures that the enforces certain abilities are available on on a particular object class. Interfaces have continued to gain popularity in PHP as the use of package management through composer has become the standard. By having standard interfaces, package maintainers can more easily build and maintain packages for common tasks such as Logging, caching and http messages.
7 stepsUsing Interfaces
Often when working with interfaces, you will be using existing interfaces. Besides the interfaces that are built-in to PHP, most frameworks include their own interfaces. These interfaces work as a kind of guaranteed documentation for using individual components. By combining multiple interfaces we can build powerful components that can be easily understood by the rest of our application.
9 stepsAbstract Classes
We'll use an abstract class to implement some base properties and methods while still requiring additional functionality.
9 stepsTeacher
-
Alena Holligan
After starting out in fine art and moving into graphic design, Alena found her passion for programming over 15 years ago and has never looked back. Alena enjoys community and is excited to introduce people to the wonderful world of PHP and the Portland Tech Community.
When not at her computer, Alena enjoys exploring Portland with her friends and family, including her 3 young children. She also enjoys the Symphony, Cooking, Books, Yarn and Yoga.