PHP OOP Tutorial | What is a PHP interface

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

Comments

Raphael A. Alves says:

In the case of shapes, couldnt you just use an abstract inheritance with abstract functions instead of interface?

Rich Williams says:

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?

Rich Williams says:

where do these functions go in your code?..do you use ‘includes’ to call them?

Sean Kelly says:

Really really great stuff. Do you do more of this?

Wyckham Seelig says:

Peter, Is the code in this tutorial available on github? Searched for it and didn’t find anything?

Carl Ortiz says:

Why don’t you just put the fraud checking method inside pay method?

Lightspeed says:

It helped me now to understand the reason why to use interfaces. Thank you! :)

Contabilidade 00 Império Contábil says:

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!!!!

webhtg says:

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 .

Rich Williams says:

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

Peter Fisher says:

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

busyrand says:

RUN PHP!!! Awesome Mug!

Thomas Varghese says:

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?

Hello World says:

Stop looking at the keyboard, and u will be making less mistakes after a while.

Rahifi Robinson says:

Hi, do you know a few emerging trends respect to php interfaces?

May See says:

Thanks for your explanation! Only interface tutorial I have understood 😀

Tom Scott says:

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?

Chrismarcel James says:

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.

Kajetan Dziebaj says:

Thanks, brah. I understand interfaces now.

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours