Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

PackagistDownloads
in package

FinalYes

Combined Packagist download count for the shields.io endpoint badge.

The project is published under two Packagist names — the original sibidharan/zealphp and the current canonical zealphp/zealphp (the name in composer.json). Packagist NEVER merges download counts across package names, so a single packagist/dt/<vendor>/<pkg> badge only ever shows one side of the split. This endpoint sums every project package name and returns the shields endpoint schema, so the README badge shows the true combined total.

Resilience: a per-worker memo with a TTL avoids hammering Packagist (the badge is also cached by shields via cacheSeconds), and a failed refresh serves the last good value rather than breaking the badge.

Table of Contents

Constants

PACKAGES  : mixed = ['zealphp/zealphp', 'sibidharan/zealphp']
Every Packagist package name this project has shipped under.
TTL  : mixed = 3600
Memo TTL (seconds) — also advertised to shields via cacheSeconds.

Properties

$memoAt  : int
$memoTotal  : int|null

Methods

endpoint()  : array{schemaVersion: int, label: string, message: string, color: string, cacheSeconds: int}
shields.io endpoint badge JSON for the combined download total.
parseTotal()  : int|null
Extract package.downloads.total from a decoded Packagist payload.
combinedTotal()  : int|null
Combined total across {@see self::PACKAGES}, memoized per worker. Returns the last good value on a failed refresh; null only when no value has ever been fetched.
fetchSum()  : int|null
humanize()  : string
1234 → "1.2k", 2_500_000 → "2.5M".

Constants

PACKAGES

Every Packagist package name this project has shipped under.

private mixed PACKAGES = ['zealphp/zealphp', 'sibidharan/zealphp']

TTL

Memo TTL (seconds) — also advertised to shields via cacheSeconds.

private mixed TTL = 3600

Properties

Methods

endpoint()

shields.io endpoint badge JSON for the combined download total.

public static endpoint() : array{schemaVersion: int, label: string, message: string, color: string, cacheSeconds: int}
Return values
array{schemaVersion: int, label: string, message: string, color: string, cacheSeconds: int}

parseTotal()

Extract package.downloads.total from a decoded Packagist payload.

public static parseTotal(mixed $decoded) : int|null

Pure (no I/O) so the parse contract is unit-testable without network.

Parameters
$decoded : mixed

json_decode($body, true) of a Packagist package JSON

Return values
int|null

combinedTotal()

Combined total across {@see self::PACKAGES}, memoized per worker. Returns the last good value on a failed refresh; null only when no value has ever been fetched.

private static combinedTotal() : int|null
Return values
int|null

fetchSum()

private static fetchSum() : int|null
Return values
int|null

sum of every package's total, or null if all sources failed.

humanize()

1234 → "1.2k", 2_500_000 → "2.5M".

private static humanize(int $n) : string
Parameters
$n : int
Return values
string
On this page