Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

spyrosjeva's avatar

Fetching data from other classes?

I have fairly good understanding of OOP in php but what confuses me is this...

i saw some examples on github where they use interfaces in some way to... lets say populate a sidebar with links when a new package is installed.

How can you get data from other classes like this without using the database?

0 likes
1 reply
biishmar's avatar

Interface is not entirely a class its a contract.. you dont usually see lengthy line of coding, you see just a method declared without anything inside...

When u implement a interface into a class u should definitely use the method that declare in interface, so every coding inside the class u implement not inside interface...

Please or to participate in this conversation.