Skip to content

ucraft-com/action-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Action Middleware Package

This package provides middleware functionality for handling actions in your Laravel application. Below, you'll find information on how to install, configure.

Installation

  1. Add the package to your composer.json file:
{
    "require": {
        "ucraft-com/action-middleware": "*"
    }
}

And run composer to update your dependencies:

composer update

Or you can simply run

composer require ucraft-com/action-middleware
  1. Publish the configuration file:
php artisan vendor:publish --tag=action-middleware
  1. Configure your middleware settings in the published config/action-middleware.php file.

  2. To integrate the Action Middleware Gateway, extend the ActionMiddlewareServiceProvider as shown below:

class ActionMiddlewareServiceProvider extends BaseActionMiddlewareServiceProvider
{
    public function getActionMiddlewareGateway(): ActionMiddlewareGatewayInterface
    {
        $config = config('action-middleware.redis.config');
        $setKey = config('action-middleware.redis.setKey')
        $connection = (new PhpRedisConnector())->connect($config, []);

        return new ActionMiddlewareRedisGateway($connection, $setKey);
    }
}

Basic Usage

Once installed and configured, you can start using the middleware to handle actions in your application. The default service provider and gateway interfaces provide flexibility for handling various use cases.

Example:

    use Uc\ActionMiddleware\ActionMiddlewareRunner;
    use Uc\ActionMiddleware\Enums\ActionType;
    
    $result = ActionMiddlewareRunner::run(ActionType::CREATE_CUSTOMER, $request->all(), ['email']);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages