Agent Skills: Interfaces and Dependency Injection

Use interfaces and dependency injection to decouple code; bind implementations in the container

UncategorizedID: noartem/laravel-vue-skills/laravel-interfaces-and-di

Install this agent skill to your local

pnpm dlx add-skill https://github.com/noartem/skills/tree/HEAD/skills/laravel-interfaces-and-di

Skill Files

Browse the full folder contents for laravel-interfaces-and-di.

Download Skill

Loading file tree…

skills/laravel-interfaces-and-di/SKILL.md

Skill Metadata

Name
laravel-interfaces-and-di
Description
Use interfaces and dependency injection to decouple code; bind implementations in the container

Interfaces and Dependency Injection

Define narrow interfaces and inject them where needed. Bind concrete implementations in a service provider.

interface Slugger { public function slug(string $s): string; }

final class AsciiSlugger implements Slugger {
  public function slug(string $s): string { /* ... */ }
}

$this->app->bind(Slugger::class, AsciiSlugger::class);

Benefits: easier testing (mock interfaces), clearer contracts, swap implementations without touching consumers.