PHPackages                             patienceman/custom-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. patienceman/custom-handler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

patienceman/custom-handler
==========================

Provide a convenient way creating single action handlers. The idea of a action handler is a single action controller that means a unique class handles each action

v1.0.0(3y ago)12.7kMITPHPPHP &gt;=8.0.0

Since May 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/patiencemanzen/patienceman-custom-handler)[ Packagist](https://packagist.org/packages/patienceman/custom-handler)[ RSS](/packages/patienceman-custom-handler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

CustomHandler | Patienceman
===========================

[](#customhandler--patienceman)

Provide a convenient way creating single action handlers. The idea of a action handler is a single action controller that means a unique class handles each action

Installation
------------

[](#installation)

Install the package doesn't require much requirement except to use the following command in the laravel terminal, and you're good to go.

```
composer require patienceman/custom-handler
```

Usage
-----

[](#usage)

To start working with handler, u need to run command 🎉 in your custom directories:

```
php artisan make:handler NewStartupHandler
```

so it will create the filter file for u, Just in

```
    App\Handlers
```

```
namespace App\Handlers;

use Patienceman\CustomHandler\Handler;

class NewStartupHandler extends Handler {
    /**
     * Custom execution from Handler Pipeline
     * @return Exception|void
     */
    public function execute() {
        // do whatever action inside handler
    }
}
```

So you may want even to specify the custom path for your Handler, Just relax and add it in front of your Handler name. Let's take again our current example.

```
php artisan make:handler Model/DatabaseHandler
```

So far so good, Let see how you can your handlers anywhere in controller or services or ...:

```
namespace App\Http\Controllers;

use App\Handlers\NewStartupHandler;
use Patienceman\CustomHandler\CustomHandler;

class TestBuilderController extends Controller {
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index() {
        $handler = CustomHandler::handle(new NewStartupHandler());
    }
}
```

But don't worry, you chain many handlers as you want, what you need to do is keep add `->handle()`, let see it in action:

```
namespace App\Http\Controllers;

use App\Handlers\NewStartupHandler;
use App\Handlers\NewCompanyHandler;
use Patienceman\CustomHandler\CustomHandler;

class TestBuilderController extends Controller {
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index() {
        $handler = CustomHandler::handle(new NewStartupHandler())
                                ->handle(new NewCompanyHandler());
    }
}
```

And now once your controller get execution, all your handler will run.

Exchanges of data
-----------------

[](#exchanges-of-data)

There might a time you need to store and exchange tou data throughout your handlers, This package provide convinient way to do so, by just use `->collect(array data)` to collect data and `->collection()` to get collected data, let take example:

In our `NewStartupHandler`:

```
namespace App\Handlers;

use Patienceman\CustomHandler\Handler;
use App\Models\Startup;

class NewStartupHandler extends Handler {
    /**
     * Custom execution from Handler Pipeline
     * @return Exception|void
     */
    public function execute() {
        $startup = Startup::create([ 'name' => "MorganTv" ]);
        $this->collect([ 'startup' => $startup ]);
    }
}
```

That look to clear 🎉, so Let see how you can call the collected data anywhere your want, for example in our `NewCompanyHandler` class:

```
namespace App\Handlers;

use Patienceman\CustomHandler\Handler;

class NewCompanyHandler extends Handler {
    /**
     * Custom execution from Handler Pipeline
     *
     * @return Exception|void
     */
    public function execute() {
        $startup = $this->collection()->get('startup');
    }
}
```

🚨 You've seen where we are using `->collection()` function, and this is coming from Laravel collection, you can read more about it to their website: [Laravel collection avalibale method](https://laravel.com/docs/8.x/collections#available-methods) for more about getting and filtering data.

There is also another way to get collected data, for instance when you're outside handler, and to apply this you use same functionality as `->collection()` after your handler, take a look:

```
namespace App\Http\Controllers;

use App\Handlers\NewStartupHandler;
use App\Handlers\NewCompanyHandler;
use Patienceman\CustomHandler\CustomHandler;

class TestBuilderController extends Controller {
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index() {
        $handler = CustomHandler::handle(new NewStartupHandler())
                                ->handle(new NewCompanyHandler())
                                ->collection()
                                ->get('startup') // or ->get(), ->filter() ->sort();
    }
}
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Connect with Me
---------------

[](#connect-with-me)

 [ ![Linkedin](https://camo.githubusercontent.com/835f91c273c180e842aa0b2fb0d5ccc52def20089589abbcefceb28317c583f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b6564496e2d3030373742353f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e266c6f676f436f6c6f723d7768697465 "Manirabona patience Linkedin")](https://www.linkedin.com/in/manirabona-patience-3b08051b4) [![Github](https://camo.githubusercontent.com/4fcd516e2fde608afc9ddd1330de295d23981c27a9b9d695f8abe51f70a1efc5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d3130303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465 "Manirabona patience Github")](https://github.com/manirabona-programer/manirabona-programer) [![Instagram](https://camo.githubusercontent.com/be49b008b2b350f82b104c71c6c4168ab1f09448919a354bdc47aea0cbf042a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f496e7374616772616d2d4534343035463f7374796c653d666f722d7468652d6261646765266c6f676f3d696e7374616772616d266c6f676f436f6c6f723d7768697465 "Manirabona Patience Instagram")](https://www.instagram.com/manirabona_walker) [![Twitter](https://camo.githubusercontent.com/9ebce40b5dc8ca37584b018fd5b5941319d135117ef1fb2330f4aa95877e79f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547769747465722d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d74776974746572266c6f676f436f6c6f723d7768697465 "Manirabona Patience Twitter")](https://twitter.com/ManirabonaW)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90353f39cc87c27ae67eb7503409539cb8fe8f879fa749cb3e51458cad85c00c?d=identicon)[Manirabona-patience](/maintainers/Manirabona-patience)

---

Top Contributors

[![patiencemanzen](https://avatars.githubusercontent.com/u/55847682?v=4)](https://github.com/patiencemanzen "patiencemanzen (23 commits)")

---

Tags

handlerslaravellibrayphplaravelhandlerscustom-handler

### Embed Badge

![Health badge](/badges/patienceman-custom-handler/health.svg)

```
[![Health](https://phpackages.com/badges/patienceman-custom-handler/health.svg)](https://phpackages.com/packages/patienceman-custom-handler)
```

###  Alternatives

[amranidev/laracombee

Recommendation system for laravel

11636.7k1](/packages/amranidev-laracombee)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

153.9k](/packages/salmanzafar-laravel-geocode)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
