Download the PHP package hellocron/php without Composer

On this page you can find all versions of the php package hellocron/php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php

HelloCron PHP SDK

tests Latest version Downloads PHP

Official PHP SDK for HelloCron: cron job, heartbeat and uptime monitoring. Works with any framework or none - the only transport requirement is a PSR-18 HTTP client (Guzzle works out of the box).

Using Laravel? The hellocron/laravel package instruments the Scheduler automatically; this SDK is the universal building block for everything else.

Installation

If your project has no PSR-18 client yet, add one (Guzzle is the usual choice):

Wrap a job

An ingest key (ck_, from the panel) is all you need. Monitors are created automatically on first ping. The fastest way to monitor a job is to wrap it:

job() sends run before your callable, complete with the measured duration after it, and fail with the exception message if it throws. All three pings share a generated series id, so overlapping runs never pair up wrong. The callable's return value is passed through, its exceptions are rethrown - only the pings themselves are fail-safe.

Pings (dead man's switch)

For full control, send the pings yourself:

ping() never throws and never blocks for long: monitoring must not be able to take down the job it monitors. It returns false when the ping could not be sent. If you want the exception instead (in a monitoring-critical path), use pingOrFail(). Stream and custom events go through event(), which is fail-safe the same way (with eventOrFail() as the throwing variant):

Management API

Add a management key (mk_, scopes read + write) to manage monitors as code. Both keys are optional and independent - pass only what you use.

For the common case - "make sure this cron job has a monitor with sane settings" - use ensure(), an idempotent upsert by name:

Manifests are plain arrays shaped exactly like the API contract - the server is the single source of validation truth, so the SDK never gets stale on manifest rules.

Config as code

Keep your monitors in a version-controlled file and apply it on deploy. YAML and JSON are supported by extension; YAML needs composer require symfony/yaml:

Errors

Management calls throw typed exceptions with stable, machine-readable codes (never match on message text):

Unknown error codes map to ErrorCode::Unknown instead of failing, so new server-side codes never break existing SDK versions.

Configuration

Everything is a constructor argument; nothing is global:

Argument Default Purpose
ingestKey null ck_ key; without it ping() returns false
managementKey null mk_ key; without it monitors()/account() throw locally
ingestUrl https://api.hellocron.com Ping API base
apiUrl https://app.hellocron.com/api/v1 Management API base
httpClient auto-discovered Any PSR-18 client; bring your own to control timeouts
requestFactory / streamFactory auto-discovered Any PSR-17 factories
logger null Any PSR-3 logger; fail-safe methods (ping(), event(), health()) log swallowed failures as warnings

Every exception the SDK throws implements HelloCron\Exception\HelloCronExceptionInterface, so one catch block covers them all.

Timeouts

PSR-18 has no timeout API, so timeouts belong to the HTTP client. When the SDK constructs the default Guzzle client itself, it sets a 2 s connect / 5 s request timeout - short on purpose, because ping() runs synchronously inside the job it monitors, and a down monitoring endpoint must cost seconds, not tens. If you inject your own client, its configuration wins and the timeouts become your responsibility:

Migrating from cronitor-php

The ping vocabulary is intentionally compatible (run / complete / fail / skip, duration, exit_code, host, series), so most call sites map one to one:

cronitor-php hellocron/php
new Cronitor\Client($apiKey) new HelloCron(ingestKey: 'ck_...', managementKey: 'mk_...')
$client->ping('key', ['state' => 'run']) $cx->ping('name', PingStatus::Run)
$client->job('key', $fn) $cx->job('name', $fn)
$client->applyConfig() $cx->monitors()->applyFromFile('monitors.yaml')
$client->validateConfig() $cx->monitors()->applyFromFile('monitors.yaml', dryRun: true)
$client->generateConfig() $cx->monitors()->exportToFile('monitors.yaml')

Differences to know about: monitors are addressed by name (created automatically on first ping), errors are typed exceptions with stable ErrorCode enums instead of raw responses, and the transport is any PSR-18 client rather than bundled cURL. See the migration guide for the platform-level differences.

Requirements

PHP 8.1+, ext-json, any PSR-18 HTTP client.

Links

License

MIT


All versions of php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1|^2.0
psr/log Version ^2.0|^3.0
php-http/discovery Version ^1.19
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hellocron/php contains the following files

Loading the files please wait ...