php Interface info

Using Interfaces to Write Better PHP Code

https://ashallendesign.co.uk/blog/using-interfaces-to-write-better-php-code


Interfaces can be:

Used to define public methods for a class.
Used to define constants for a class.

Interfaces are used to define the public methods that a class should include. It’s important to remember that only the method signatures are defined and that they don’t include the method body (like you would typically see in a method in a class). This is because the interfaces are only used to define the communication between objects, rather than defining the communication and behaviour like in a class.

Interfaces cannot be:

Instantiated on their own.
Used to define private or protected methods for a class.
Used to define properties for a class.

Blogbook : PHP | Javascript | Laravel | Corcel | CodeIgniter | VueJs | ReactJs | WordPress