Sentry-laravel: show composer require statement in readme

Created on 25 Sep 2020  路  4Comments  路  Source: getsentry/sentry-laravel

finding your laravel package i have no way of knowing to composer require sentry/sentry-laravel w/out looking at composer.json in the repo, please throw this in the read me for convenience reasons

question

All 4 comments

There are more instructions than just that.

That is why we provide documentation links for the different Laravel/Lumen versions in the readme where we mention the composer require command.

We believe this should be enough and there is no need to also list it here also since you would probably need to go to the documentation anyway to correctly setup this package.

(I did see we did not mention 8.x in the documentation links, but that is fixed now)

It still is a nice convenience for standard composer packages @stayallive , also you might want to look into changing the report() example as 7.x and later since that has changed for 8.x.

https://laravel.com/docs/8.x/errors#reporting-exceptions

Let me know what you think of this approach actually if you don't mind @stayallive

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        $this->reportable(function (Exception $e) {
            if (auth()->check() && app()->bound('sentry')) {
                if (auth()->check()) {
                    configureScope(function (Scope $scope): void {
                        $scope->setUser([
                            'id' => auth()->user()->id,
                            'avatar' => auth()->user()->avatar,
                            'username' => auth()->user()->name,
                            'email' => auth()->user()->email,
                        ]);
                    });
                }
            }
            app('sentry')->captureException($e);
        });
    }

I believe this should work just fine 馃憤

Was this page helpful?
0 / 5 - 0 ratings