Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lumen support #72

Closed
einkoro opened this issue Feb 23, 2016 · 5 comments
Closed

Lumen support #72

einkoro opened this issue Feb 23, 2016 · 5 comments

Comments

@einkoro
Copy link

einkoro commented Feb 23, 2016

Any possibility of supporting Lumen?

@freekmurze
Copy link
Member

I'm not a Lumen user myself, so I won't probably work on this. If you need Lumen support, send a PR.

@etiennemarais
Copy link

Hey, It seems like you have to manually bind the filesystem contracts in lumen. Try this in your bootstrap/app.php file?

$app->singleton('filesystem', function ($app) {
    return $app->loadComponent('filesystems', Illuminate\Filesystem\FilesystemServiceProvider::class, 'filesystem');
});
$app->bind(Illuminate\Contracts\Filesystem\Factory::class, function($app) {
    return $app['filesystem'];
});

@etiennemarais
Copy link

Also, Seems like Illuminate\Contracts\Logging\Log::class is a hard dependency and lumen uses raw monolog. So if you want to get around that I suggest adding the illuminate log component to your composer.json like so:

"illuminate/log": "~5.2"

Also add this in your bootstrap/app.php:

$app->bind(Illuminate\Contracts\Logging\Log::class, function($app) {
    return $app['Psr\Log\LoggerInterface'];
});

and overwrite your LumenApplication class with your own and add an overwrite for the registerLogBindings method like so:

protected function registerLogBindings()
    {
        $this->singleton('Psr\Log\LoggerInterface', function () {
            if ($this->monologConfigurator) {
                $monolog = call_user_func($this->monologConfigurator, new Logger('lumen'));
            } else {
                $monolog = new Logger('lumen', [$this->getMonologHandler()]);
            }

            return new \Illuminate\Log\Writer($monolog); // <---this implements the correct contract
        });
    }

Worked for me, you might want to refactor the interface binding to an interface binding to a concrete to be cleaner but this works for lumen :)

@maojindao55
Copy link

maojindao55 commented Sep 14, 2016

@etiennemarais , as your way, and now it came the error:

Fatal error: Call to undefined function Spatie\Backup\config_path() in /data/www/wxdv/vendor/spatie/laravel-backup/src/BackupServiceProvider.php on line 20

@maihannijat
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants