laravel-strategy-pattern

Use the Strategy pattern to select behavior at runtime; bind multiple implementations to a shared interface

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "laravel-strategy-pattern" with this command: npx skills add noartem/laravel-vue-skills/noartem-laravel-vue-skills-laravel-strategy-pattern

Strategy Pattern

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

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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

shadcn-vue

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel-routes-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
General

baseline-ui

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel-internationalization-and-translation

No summary provided by upstream source.

Repository SourceNeeds Review