# Laravel Interfaces And Di

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

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

---


# 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.

