sentry/sentryis the core PHP SDK, not an application or framework bundle.- Public entry points include the autoloaded global helpers in
src/functions.phpand the public classes and interfaces undersrc/. - Use this file for repo-specific constraints that are easy to miss, and explore the codebase for current implementation details.
- The minimum supported PHP version for shipped code is
7.2.composer.jsonrequires^7.2|^8.0, so shipped code must remain valid on PHP7.2unless support policy is intentionally being changed. - This SDK has a broad public API surface. Treat changes to global helpers,
Options,ClientBuilder,ClientInterface,HubInterface,TransportInterface,IntegrationInterface, tracing/logs/metrics types, and Monolog handlers as BC-sensitive. - Preserve the existing cross-version compatibility style. This repo supports
multiple
psr/log,symfony/options-resolver,guzzlehttp/psr7, andmonolog/monologmajor versions. - Do not assume optional packages or binaries are available. Monolog is only a suggested dependency, and FrankenPHP/RoadRunner worker coverage depends on optional binaries and dev dependencies.
Spotlightis treated as an active send path alongside DSN-based delivery. Do not gate runtime setup or transport behavior on DSN alone.
- Keep
declare(strict_types=1);in PHP files. - Follow the existing formatting rules from
.php-cs-fixer.dist.php. - If you add or change an SDK option, update the resolver/defaults in
Options, the relevant getters and setters, theinit()option array-shape docs insrc/functions.php, and the affected tests. src/functions.phpis autoloaded and part of the public API. Keep helper signatures, phpdoc, and runtime behavior synchronized with the underlying client, hub, and runtime-context implementation. Functions insrc/functions.phpshould use camelCase naming.IntegrationRegistryintentionally callssetupOnce()only once per integration class during the process lifetime. Preserve de-duplication and default-integration gating when changing integration setup behavior.ErrorHandlerhas fragile register-once, previous-handler chaining, reserved memory, and out-of-memory behavior. Preserve that lifecycle carefully and add PHPT coverage when changing fatal or silenced error handling.SentrySdk::startContext(),endContext(), andwithContext()must keep runtime-context isolation and best-effort flushing intact for logs, metrics, and transport in long-running worker scenarios.HttpTransportandPayloadSerializerare tightly coupled. Preserve the envelope item selection, Spotlight delivery path, dynamic sampling context, and the transaction/profile relationship when changing transport or serialization behavior.- Monolog support spans multiple Monolog major versions through the
compatibility traits and handlers under
src/Monolog/. Preserve that compatibility style when changing logging integrations. Client::SDK_VERSIONis updated by the release action viascripts/bump-version.sh. Do not modify it manually as part of normal development changes.
- Add tests with every behavior change. This is a library repo with broad compatibility and regression coverage.
- New tests belong under
tests/. phpunit.xml.distdefines aunitsuite that includes both PHPUnit tests andtests/phpt, plus a separateoomsuite fortests/phpt-oom.- Prefer targeted PHPUnit runs while iterating.
- After editing files, run the relevant formatting, lint, and test commands for the code you changed.
- Before handing back substantive code changes, run
composer checkwhen feasible and call out anything you could not run. - If you change error handling, fatal error capture, or PHP-version-specific behavior, add or update PHPT coverage.
- If you change runtime-context or worker-mode behavior, add or update focused coverage for the FrankenPHP or RoadRunner paths as appropriate.
phpstan.neononly analyzessrc, usesphpstan-baseline.neon, and will not catch behavior regressions intests/or PHPT coverage.phpunit.xml.distis strict about unexpected output, so noisy debug output will fail tests.- This repo is a library, so do not expect a runnable application entrypoint.
README.mdandCHANGELOG.mdare updated manually during releases, so do not modify them as part of normal development changes.- If a change may require updates in the separate documentation repo, ask the
user whether to review
../sentry-docsif that sibling checkout exists. If it does not exist, ask the user for the local docs path first. If they opt in, update that repo'smasterbranch when safe, use git worktrees to inspect the relevant docs, and suggest any needed changes to avoid stale documentation. - If a change affects installation, configuration, error handling, tracing, profiling, metrics, logs, or worker-mode behavior, call out the likely README or release-note follow-up in your summary instead of editing those files automatically.
.github/workflows/ci.ymlruns the PHPUnit compatibility matrix across Ubuntu and Windows, lowest and highest dependencies, and separate runtime jobs for FrankenPHP and RoadRunner..github/workflows/static-analysis.yamlruns PHP-CS-Fixer, PHPStan, and Psalm on single recent PHP versions rather than across the full test matrix.