PHPackages                             marklj/funnel - 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. [Framework](/categories/framework)
4. /
5. marklj/funnel

ActiveLibrary[Framework](/categories/framework)

marklj/funnel
=============

A catch-all controller (for Laravel).

v1.0(9y ago)125PHP

Since Sep 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/marklj/funnel)[ Packagist](https://packagist.org/packages/marklj/funnel)[ RSS](/packages/marklj-funnel/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Funnel
======

[](#funnel)

A catch-all controller (for Laravel)

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

[](#installation)

1. Install from Composer:

```
composer require marklj/funnel
```

2. Add `Marklj\Funnel\FunnelServiceProvider` to your `app.php` service provider configuration values.
3. Publish the packages configuration:

```
php artisan vendor:publish
```

Quick Start
-----------

[](#quick-start)

### 1. Send a request

[](#1-send-a-request)

Send a POST request to `/mailbox`. You can do this with AJAX from your front-end library of choice (Angular / Vue / etc), but for simplicity, we'll use a simple HTML form example.

The default Funnel endpoint is `/mailbox`, but this can be configured in the `funnel.php` configuration file that was published in the installation section.

The `command` request parameter is required and is automatically converted to StudlyCase when processed by Funnel.

```

    Submit

```

Note that data does not need to be contained in a `payload[]` array unless you want to filter exactly what perameters are passed to your action. If you do not namespace your inputs, like `name="blog_title"`, all of your input data will be passed to your action.

### 2. Map to an Action

[](#2-map-to-an-action)

Funnel will try to associate the StudlyCase command, in this case `PostBlog`, to an action. This association is made in the `funnel.php` configuration file.

```
// config/funnel.php
[
    // ...

    'action_mappings' => [
        'PostBlog' => \App\Blog\Actions\PostAction::class,

        // other mappings here
    ]
]
```

### 3. Create Action

[](#3-create-action)

The action class must implement the `Marklj\Funnel\Actionalble` interface. You are free to place whatever code you need here.

All of your payload data data will be available in the `ActionPayload` object.

```
