Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP-PM Lumen adapter
<?php
namespace App\PHPPM;
use Illuminate\Container\BoundMethod;
use Illuminate\Support\ServiceProvider;
use PHPPM\Bootstraps\Laravel;
class LumenAdapter extends Laravel
{
/**
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function postHandle($app)
{
$this->resetProvider(\App\Providers\AuthServiceProvider::class);
$this->resetProvider(\Illuminate\Session\SessionServiceProvider::class);
}
/**
* @param \Illuminate\Support\ServiceProvider|string $provider
*/
protected function resetProvider($provider)
{
if (! $provider instanceof ServiceProvider) {
$provider = new $provider($this->app);
}
if (method_exists($provider, 'register')) {
$provider->register();
}
if (method_exists($provider, 'boot')) {
BoundMethod::call($this->app, [$provider, 'boot']);
}
}
}
@isbkch
Copy link

isbkch commented Mar 6, 2019

How do you use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment