Running an outdated Laravel application? I voiced my preference for the recent https://www.youtube.com/watch?v=lXsbFXYwxWU, and many people told me I was wrong: an interface is only a contract and shouldn't provide implementations.

If this is the only way you're using interfaces, then yes, you're right: interface default methods aren't necessary.

Here's the so called LoggerInterface, part of https://www.php-fig.org/psr/psr-3/: interface LoggerInterface { public function emergency( string|\Stringable $message, array $context = []): void; public function alert( string|\Stringable $message, array $context = []): void; public function critical( string|\Stringable $message, array $context = []): void; public function error( string|\Stringable $message, array $context = []): void; public function warning( string|\Stringable $message, array $context = []): void; public function notice( string|\Stringable $message, array $context = []): void; public function info( string|\Stringable $message, array $context = []): void; public function debug( string|\Stringable $message, array $context = []): void; public function log( $level, string|\Stringable $message, array $context = []): void; }

These methods will always look the same: public function debug( string|\Stringable $message, array $context = []): void { $this->log(LogLevel::DEBUG, $message, $context); }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners