Skip to content
Back to skills

Laravel Strategy Pattern

ASecurity

Create a common interface and multiple implementations. Choose a strategy by key or context. ```php interface TaxCalculator { public function for(int $cents): int; } final class NzTax implements TaxCalculator { /* ... */ } final class AuTax implements TaxCalculator { /* ... */ } final class TaxFactory { public function __construct(private array $drivers) {} public function forCountry(string $code): TaxCalculator { return $this->drivers[$code]; } } ``` Register in a service provider and inject...

  • 67 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added November 10, 2026
ai-agentsphp

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add ComeOnOliver/skillshub --skill laravel-strategy-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Laravel Strategy Pattern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Laravel Strategy Pattern
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/comeonoliver-laravel-strategy-pattern/badge)](https://www.skillsdirectory.com/skills/comeonoliver-laravel-strategy-pattern)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Strategy Pattern

Create a common interface and multiple implementations. Choose a strategy by key or context.

```php
interface TaxCalculator { public function for(int $cents): int; }
final class NzTax implements TaxCalculator { /* ... */ }
final class AuTax implements TaxCalculator { /* ... */ }

final class TaxFactory {
  public function __construct(private array $drivers) {}
  public function forCountry(string $code): TaxCalculator { return $this->drivers[$code]; }
}
```

Register in a service provider and inject the factory where needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.