Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Actions Laravel Package

sarfraznawaz2005/actions

A lightweight Laravel package for organizing business logic into reusable action classes. Define self-contained actions with validation, authorization, and hooks, then run them anywhere—controllers, commands, jobs, or other actions—to keep your code clean, testable, and easy to maintain.

View on GitHub
Deep Wiki
Context7

Laravel package as alternative to single action controllers with support for web and api in single class.

Frequently asked questions about Actions
What is sarfraznawaz2005/actions used for in Laravel?
It is a lightweight Laravel package for moving business logic out of controllers into reusable action classes. Each action can bundle validation, authorization, and hooks, and can be invoked from controllers, commands, jobs, or other actions. It is intended as an alternative to single action controllers, especially when you want web and API handling in one class.
How do I install sarfraznawaz2005/actions?
Install it with Composer by running composer require sarfraznawaz2005/actions in your Laravel project. Laravel package discovery should register the package automatically if it provides a service provider. Check the repository README for any version-specific registration, configuration, or publishing steps.
How is this package different from Laravel single action controllers?
Single action controllers are still HTTP entry points, while this package focuses on reusable action classes that are not tied to a route. You can run the same action from a controller, command, job, or another action. The package also adds built-in support for validation, authorization, hooks, and handling both web and API flows in a single class.
Can one action class handle both web and API requests?
Yes, the package is designed so a single action class can support web and API use cases. You can keep shared business logic in the action and branch or configure request handling as needed. This avoids duplicating the same operation across separate web and API controllers.
How do validation and authorization work inside an action?
The action class can define its own validation and authorization rules alongside the business logic it executes. That keeps request checks close to the operation instead of scattering them across controllers. Consult the package README for the exact method names and signatures for your installed version.
What are action hooks and when should I use them?
Hooks are lifecycle extension points that let you run code before or after an action executes. They are useful for cross-cutting tasks such as logging, audit trails, cache clearing, or dispatching follow-up work without crowding the action's main logic. Use them when the behavior should apply consistently every time the action runs.
Can I run actions from Laravel commands, jobs, or other actions?
Yes, actions are meant to be reusable outside HTTP controllers, including from Artisan commands, queued jobs, and other actions. You invoke the action directly rather than routing through a controller. This makes the same business operation available in CLI, background, and HTTP contexts.
Which Laravel versions does sarfraznawaz2005/actions support?
The supported Laravel and PHP versions are defined in the package's composer.json and release notes. Check Packagist and the GitHub repository for the current constraints before installing. If you are on an older Laravel release, verify compatibility rather than assuming the latest package version will work.
How should I test Laravel actions from this package?
Because actions are plain classes, you can instantiate and call them directly in unit or feature tests. Test validation and authorization paths as well as the main business outcome, and use Laravel's testing helpers when the action touches the container, database, or HTTP layer. Check the README for any package-specific test helpers or base action classes.
Is sarfraznawaz2005/actions suitable for production, and what are alternatives?
It can be suitable for production if its documented Laravel compatibility, release activity, and test coverage meet your project's standards. Review the repository's commit history, open issues, and Packagist releases before adopting it. Alternatives include Laravel single action controllers, service classes, or other action-oriented packages, so compare based on your need for validation, authorization, hooks, and web/API support in one class.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager