Download the PHP package cronitor/cronitor-php without Composer
On this page you can find all versions of the php package cronitor/cronitor-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cronitor/cronitor-php
More information about cronitor/cronitor-php
Files in cronitor/cronitor-php
Package cronitor-php
Short Description Cronitor PHP Library
License MIT
Homepage https://cronitor.io/
Informations about the package cronitor-php
Cronitor PHP Library
Cronitor provides end-to-end monitoring for background jobs, websites, APIs, and anything else that can send or receive an HTTP request. This library provides convenient access to the Cronitor API from applications written in PHP. See our API docs for detailed references on configuring monitors and sending telemetry pings.
In this guide:
- Installation
- Monitoring Background Jobs
- Sending Telemetry Events
- Configuring Monitors
- Package Configuration & Env Vars
Installation
To use manually, you can include the init.php
file from source.
Monitoring Background Jobs
The $cronitor->job
function will send telemetry events before calling your function and after it exits. If your function raises an exception a fail
event will be sent (and the exception re-raised).
Sending Telemetry Events
If you want to send a heartbeat events, or want finer control over when/how telemetry events are sent for your jobs, you can create a Monitor
instance and call the .ping
method.
Configuring Monitors
You can configure all of your monitors using a single YAML file. This can be version controlled and synced to Cronitor as part of a deployment or build process. For details on all of the attributes that can be set, see the Monitor API documentation.
The cronitor.yaml
file includes three top level keys jobs
, checks
, heartbeats
. You can configure monitors under each key by declaring a monitor key
and defining Monitor attributes
You can also create and update monitors by calling $cronitor->monitors->put
. For details on all of the attributes that can be set see the Monitor API [documentation)(https://cronitor.io/docs/monitor-api#attributes).
Pause, Reset, Delete
Package Configuration
The package needs to be configured with your account's API key
, which is available on the account settings page. You can also optionally specify an api_version
and an environment
. If not provided, your account default is used. These can also be supplied using the environment variables CRONITOR_API_KEY
, CRONITOR_API_VERSION
, CRONITOR_ENVIRONMENT
.
Contributing
Pull requests and features are happily considered! By participating in this project you agree to abide by the Code of Conduct.
To contribute
Fork, then clone the repo:
git clone [email protected]:your-username/cronitor-php.git
Push to your fork and submit a pull request