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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners