Skip to content

fitdev-pro/middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FitMiddleware

Simply Middleware Implementation.

Installation

composer require fitdev-pro/middleware

Usage

Base usage

<?php
    $hundler = new MiddlewareHundler(new Resolver(), new Queue());

    $hundler->append(Foo/Bar/SomeClass::class);

    $hundler->append(function ($input, $output, $next){
       $data += 1;

       return $next($data);
    });

    $hundler->append(function ($input, $output, $next){
        $data += 2;

        if($data > 4){
            return $data;
        }
        
        return $next($data);
    });

    $hundler->append(function ($input, $output, $next){
        $data += 3;

        return $next($data);
    });
    
    $newData = $hundler->hundle(2);

Contribute

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License

The MIT License (MIT). Please see License File for more information.

About

Simply Middleware Implementation.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages