laravel:interfaces-and-di

📁 jpcaparas/superpowers-laravel 📅 Jan 21, 2026
21
总安装量
12
周安装量
#17312
全站排名
安装命令
npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel:interfaces-and-di

Agent 安装分布

claude-code 10
antigravity 6
windsurf 6
opencode 5
cursor 5

Skill 文档

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.