A PHP tutorial demonstrating how to use interfaces to make your code cleaner, reusable and adhere to certain solid principles. This PHP tutorial is aimed at PHP developers at a beginner level who are learning object orientated programming (OOP)
==== GET EARLY ACCESS TO FUTURE VIDEOS & TUTORIALS ====
Patron: http://bit.ly/2hmVKwX
======== RECOMMENDED PROGRAMMING RESOURCES ========
Manning programming books and courses: http://bit.ly/2BIrExp
PHP Books:
http://howtocodewell.net/shop/books/php
PHP Hosting from Cloudways:
http://bit.ly/2CB4mWD
======== MY PROGRAMMING COURSES ========
Docker in Motion: http://bit.ly/2vvz2sA
Skillshare courses: http://skl.sh/2gI33M5
Udemy courses: http://bit.ly/2iGhvIE
======== WEB HOSTING DEALS ========
Cloudways: http://bit.ly/2CKb79b = 20% off first 6 months
Digital Ocean: https://m.do.co/c/9d4641c62263 = $10 off
Linode: http://bit.ly/2CmoNq3
======== SUBSCRIBE TO THE NEWSLETTER ========
Join the Newsletter: http://bit.ly/2fPlG3v
======== FOLLOW ME ========
Blog: http://peterfisher.me.uk
Facebook: http://facebook.com/howtocodewell/
Instagram: http://instagram.com/howtocodewell/
Twitter: http://twitter.com/howToCodeWell
Pintrest: http://pinterest.co.uk/howtocodewell/
Twitch: http://twitch.tv/howtocodewell
======== MY TALKS ========
How to put your Docker image on a diet: http://bit.ly/2y5KMly
======== SUPPORT THE CHANNEL ========
Become a Patron: http://bit.ly/2hmVKwX
Donate: https://www.paypal.me/howToCodeWell
Help translate the videos: http://bit.ly/2iEyxXB
======== VIDEO SETUP ========
Nikon D5300 Camera: http://amzn.to/2u5jreD
Logitech HD Pro Webcam C920 http://amzn.to/2C5NNVJ
CRAPHY Photography Studio Lights: http://amzn.to/2BThzOc
Rode Procaster Microphone: http://amzn.to/2sH2WJ1
Rode VideoMic Pro: http://amzn.to/2vmNF0D
Zoom H4NPro: http://amzn.to/2kZrrvo
Amazon Auto Links: No products found.
In the case of shapes, couldnt you just use an abstract inheritance with abstract functions instead of interface?
you know you use an interface to be able to swap between different classes… wouldnt a drop down menu on the users side do the same? or is this what the interface allows you to do on the users side?
where do these functions go in your code?..do you use ‘includes’ to call them?
Really really great stuff. Do you do more of this?
Peter, Is the code in this tutorial available on github? Searched for it and didn’t find anything?
Why don’t you just put the fraud checking method inside pay method?
It helped me now to understand the reason why to use interfaces. Thank you! 🙂
Ok, this makes me look stupid but the truth is that I am a PHP developer for over a decade and never understood the purpose of interfaces. Yes, I have read a dozen of tutorials and stuff but yeah, it never broke into my skull.
Your payment example just did the click in my brain. It further consolidated when you said at the end that there is no need for a bunch of if statements.
Thank you mate!!!!
Great explanation Sir . I watched some videos about SOLID principle and if I am not wrong , the example shown in this video is Interface Segregation . Waiting for full in-depth tutorials with examples about SOLID in PHP . thanks again for this video .
i thought duplication was a bad thing..is there a better way to put the three shapes in the same class or call them with the same attributes somehow? i like the format of code and you on same screen..alot easier to concentrate. thx
Today’s tutorial covers PHP interfaces! Interfaces are the very important for object oriented programming. Let me know what other OOP subjects you wish me to cover in future videos
RUN PHP!!! Awesome Mug!
Thanks for the great tutorial. There is a confusion I am having about the object you declared for the payment gateway example. Since you created an object only for mintfee and passed it how will other 2 class methods will be code. I tried to run the code you have given and only the mintfee class methods are called. Can you explain that and clear the doubt?
Stop looking at the keyboard, and u will be making less mistakes after a while.
Hi, do you know a few emerging trends respect to php interfaces?
Thanks for your explanation! Only interface tutorial I have understood 😀
This is a great explanation. Just one thing. In the first 10 minutes with the shape example, you added ‘shape interface’ as a parameter in the addShape method. What does this do as I believe this would still work with only $shape as the argument?
I’m just seeing this video and I appreciate your simplified explanation, I just read a source on Dependency Injection and how ir eliminates tight coupling. This looks quite similar to what was implemented in the source I read. Could your example be likened to a somewhat implementation of Dependency Injection.
Thanks, brah. I understand interfaces now.