Search code examples
phplaravelenvironment-variablessentrydsn

Understanding the distinction between "SENTRY_DSN" and "SENTRY_LARAVEL_DSN" environment variables in Laravel's Sentry package


What is the difference between the "SENTRY_DSN" and "SENTRY_LARAVEL_DSN" environment variables in the Sentry package within Laravel? Need clarification or guidance to a reliable source explaining their distinctions.

Demystifying the similarity or dissimilarity between "SENTRY_DSN" and "SENTRY_LARAVEL_DSN" environment variables in Laravel's Sentry package.


Solution

  • According to the changelog for the getsentry/sentry-laravel package, they changed their .env variable from SENTRY_DSN to SENTRY_LARAVEL_DSN in version 0.9.0.

    The SENTRY_DSN environment variable is used by the base getsentry/sentry-php package. In order to avoid the collision with the base package, and to allow the Laravel package to be in control of the DSN name, the Laravel package renamed their environment variable.

    However, the Laravel package will use the base SENTRY_DSN environment variable if the SENTRY_LARAVEL_DSN environment variable isn't defined.

    If you're only using sentry through the Laravel package, you only need SENTRY_LARAVEL_DSN. If you're using the base sentry package outside of Laravel, you'll need SENTRY_DSN.