Interfaces

An interface defines a contract: a list of public methods without implementation. A class that implements it with implements must provide all those methods, and can implement several interfaces. Code can thus depend on the contract rather than on a specific class.

Example

interface Exportable {
  public function exporter(): string;
}

Related concepts

The whole glossary