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 compatability #247

Merged
merged 2 commits into from
Aug 20, 2019
Merged

Conversation

andrewnclark
Copy link
Contributor

Q A
Bug fix? No
New feature? No
Fixed tickets #235

Following the conversion in #235 this PR updates the Laravel service provider to detect when it is being used in a Lumen application and avoid calling $this->publishes as the publish command is not available.

We could potentially make a separate Lumen service provider if preferred.

With the above changes in mind, I also updated the documentation to provide steps for install phpinsights in a Lumen app.

$this->publishes([
__DIR__ . '/../../../../stubs/laravel.php' => $this->app->configPath('insights.php'),
], 'config');
if (strpos($this->app->version(), 'Lumen') !== 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you double check that this code is working as expected in a normal lararel application?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a method called version in Laravel, and that one just returns a version number in Laravel.

However I think a "better" way to do this is to check $this->app implements Illuminate\Contracts\Foundation\Application, because then we know it's a Laravel project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I did write the instanceof version first and changed it, I'll switch back to... always trust your initial thoughts!

docs/get-started.md Outdated Show resolved Hide resolved
@andrewnclark
Copy link
Contributor Author

andrewnclark commented Aug 19, 2019

Made the requested changes and rebased onto the current version of master. I can also confirm that I have tested it with a Laravel installation and the service provider still works as expected.

Copy link
Owner

@nunomaduro nunomaduro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect.

@nunomaduro nunomaduro merged commit a0a8c61 into nunomaduro:master Aug 20, 2019
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

Successfully merging this pull request may close these issues.

3 participants