Download the PHP package shafimsp/laravel-actions without Composer

On this page you can find all versions of the php package shafimsp/laravel-actions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-actions

Laravel Actions

A lightweight action executor with middleware pipeline for Laravel applications. Implements the CQRS pattern with convention-based handler resolution, return type validation, caching, and first-class testing support.

Requirements

Installation

The package auto-registers its service provider. Optionally publish the config:

Quick Start

1. Define an Action

Actions are simple classes that implement the Action interface and declare their return type via a docblock:

2. Create a Handler

By convention, the handler class is the action class name suffixed with Handler in the same namespace:

3. Execute the Action

Defining Actions

Declare the return type using the @implements docblock:

Supported return types: scalars (string, int, float, bool, array), objects, nullable types, union types, void, and mixed.

The executor validates the handler's return value against the declared type at runtime and throws a RuntimeException on mismatch.

Handler Resolution

Convention-Based (Default)

Append Handler to the action class name in the same namespace:

Action Handler
App\Actions\CreateUser App\Actions\CreateUserHandler
App\Queries\FindUser App\Queries\FindUserHandler

Attribute-Based

Use the #[HandledBy] attribute to specify a custom handler:

Middleware

Middleware wraps the action execution pipeline, enabling cross-cutting concerns like logging, authorization, or caching.

Class-Based Middleware

Closure-Based Middleware

Global Middleware

Register middleware for every action in config/actions.php:

Middleware can short-circuit the pipeline by returning early without calling $next(), or modify the action before passing it along.

Caching

Cache action results automatically using the #[Cacheable] attribute:

Parameters:

The CacheMiddleware is included in the default middleware stack. It uses cache tags when available and a distributed lock to prevent cache stampede.

Bootstrap Cache

For production, generate a bootstrap cache to skip reflection on every request:

This discovers all actions, resolves their handlers and return types, and writes a cache file to bootstrap/cache/actions.php.

To clear:

Configuration

Testing

The package provides a FakeExecutor with a fluent assertion API.

Faking the Executor

Assertions

Full Test Example

License

MIT


All versions of laravel-actions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/container Version ^11.0|^12.0
illuminate/pipeline Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shafimsp/laravel-actions contains the following files

Loading the files please wait ...