This downloads mathx from the community registry (http://hphp.ch:8930), shows a permission summary for review, adds it to hphp.yaml, installs it into .hphp/packages/mathx/ and pins its checksum in hphp.lock:
require:
mathx: "^1.0"
Outside a project
hphp pkg install mathx # install globally into $HPHP_HOME/packages
hphp create myapp # or start a project, then: hphp install mathx
Use it
import "mathx";
In non-interactive environments (CI), pass --trust to accept a community package without prompting (hphp install --trust). See Official and community packages.
Package
mathx
Version
1.0.0
Source
Community registry (http://hphp.ch:8930)
Entry file
mathx.hphp
Documentation
API Reference
clampi(int $v, int $lo, int $hi): int — Clamps $v into the inclusive range [$lo, $hi].
sqi(int $v): int — Returns $v * $v.
Examples
01Clamping and squaring integers
Install mathx from the community registry, then import it in any HolyPHP file.