# Laravel Interfaces And Di

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

- Skill: `noartem/laravel-interfaces-and-di-2` (Agent Skill)
- Install (CLI): `npx get-skill add noartem/laravel-interfaces-and-di-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/noartem/laravel-interfaces-and-di-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: noartem (https://skillmd.com/u/noartem)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/noartem/laravel-interfaces-and-di-2

---


# Interfaces and Dependency Injection

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

```php
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.

