I was working in a newly-inherited application, and one of my first tasks was to set up Sentry, so we could monitor exceptions in production, and get a feel for existing performance issues. Installing the package worked fine, but when I went to run
artisan sentry:test to generate a test error, it failed with a cURL error.
Digging a little deeper, it turns out there was a bug in a version of the http client package related to specific versions of cURL and PHP. This error was fixed months ago, but I was still getting it and I had just installed the Sentry package.
Looking closer at
composer.json, I saw that the previous developer had directly installed
symfony/http-client even though this dependency was already brought in by Laravel. This top-level reference in
composer.json was effectively pinning it, and by extension everything that depended on it, like my Sentry package.
The solution was to remove this top-level reference with
composer remove symfony/http-client. It doesn't actually uninstall the package since Laravel has it as a dependency, but now when I re-installed Sentry, it could update the underlying dependencies to pull in the newer version with the curl fix. I'm not entirely sure why the previous developer installed it this way, but it sparked the idea for today's tip.
Take a look at your
composer.json and make sure you're not explicitly installing dependencies if you don't have a very clear reason for doing so. It will likely save you some grief down the road.