Skip to content

Helpers: Lumen Helper

Dan Alvidrez edited this page Jul 12, 2018 · 22 revisions

The LumenHelper class is where all the normal Laravel helpers can be found.

WP Lumen Framework can instantiate multiple plugins at once, so Facades are disabled by default and helper functions are only available via methods called on the LumenHelper class instance. The LumenHelper class will be instantiated with access to your plugin container when you import the class into any controller. See the included example controllers for composition.

Non Controller / Inline Example:

$helper = \App\Helpers\LumenHelper::plugin('MyNamespace');

$helper->cache()->get('myData');

$helper->app()->make('mySpecialClass');

Controller Import Example

public function __construct(LumenHelper $helper){
    $this->helper = $helper;
    $this->request = $this->helper->request();
    $this->auth = $this->helper->auth();
    $this->wpHelper = $this->helper->wpHelper();
}
Clone this wiki locally