laravel-actions

Encapsulate Laravel domain logic into invokable action classes.

1|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/rokkay/doc2memo --skill laravel-actions-rokkay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-actions
Source: https://github.com/rokkay/doc2memo/tree/main/.ai/skills/laravel-actions
Command: npx skills add https://github.com/rokkay/doc2memo --skill laravel-actions-rokkay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel applications often couple domain logic with controllers and services, making maintenance and testing harder. This Skill provides a pattern to encapsulate business rules in invokable actions, promoting modularity and testability.

Core Features & Use Cases

  • Action-based domain logic with invokable classes (__invoke)
  • Stateless, single-responsibility actions
  • Dependency injection-based composition of actions
  • Transactional data safety and guard methods
  • Testing patterns for unit and integration tests
  • Clear naming conventions and reusable workflows

Quick Start

Create an action class that implements __invoke and inject it via dependency injection in your controller to start orchestrating domain logic.

Frequently Asked Questions about laravel-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple domain logic from Laravel controllers to improve testability?

Encapsulate business rules in invokable action classes to decouple domain logic from Laravel controllers. This promotes single responsibility and modularity, making complex workflows easier to test and maintain.

What is the best way to organize complex Laravel workflows into reusable components?

Organize complex Laravel workflows by breaking them down into stateless, single-responsibility action classes. These invokable actions compose complex workflows through dependency injection, ensuring clear naming conventions and reusable logic.

How do I use dependency injection to compose action classes in Laravel?

Inject action classes directly into your controllers, services, or jobs via dependency injection to compose actions. This allows you to seamlessly orchestrate complex domain logic workflows by combining multiple single-responsibility actions.

Can I wrap Laravel database transactions inside an action class?

Yes, invokable action classes support transactional data modifications to ensure database safety. They also include guard methods for enforcing business rules before executing the core logic within the transaction.

How do I write unit and integration tests for Laravel action classes?

Write tests for Laravel action classes using standardized testing patterns provided by the action structure. Because actions are stateless and single-responsibility, you can easily unit test isolated business rules and integration test complex composed workflows.

When should I avoid using invokable action classes in a Laravel application?

Avoid using invokable action classes for very simple CRUD operations where standard Laravel controllers suffice. Actions excel at encapsulating complex domain logic and business rules, so adding them for trivial operations may introduce unnecessary boilerplate.