PHP

Report releases to BugSnag using a PHP script.

With the BugSnag PHP library installed and configured, notify BugSnag of your build by calling the build with any or all of the following arguments:

  • $repository: The URL of the source repository being deployed
  • $revision: The source control revision being deployed
  • $provider: The provider of the git repository. Required for on-premise providers, one of: github-enterprise, bitbucket-server, gitlab-onpremise
  • $builderName: The name of the person or machine performing the build. Defaults to whoami

For example:

$bugsnag->build(repository: "https://github.com/bugsnag/example",
                revision: "ef7bebf8bdb1919d947afe46ab4b2fb4278039b3",
                builderName: "MyExampleUser");
Bugsnag::build(repository: "https://github.com/bugsnag/example",
               revision: "ef7bebf8bdb1919d947afe46ab4b2fb4278039b3",
               builderName: "MyExampleUser");
$this->get('bugsnag')->build(repository: "https://github.com/bugsnag/example",
                             revision: "ef7bebf8bdb1919d947afe46ab4b2fb4278039b3",
                             builderName: "MyExampleUser");

Release stage, API key, and the application version are automatically detected from your existing configuration.

Laravel users can also create builds using an Artisan command in the BugSnag PHP library or you can call our Build API directly.