-
PHP 8.1 or later (debug build recommended for development:
--enable-debug) -
C compiler: GCC 11+, Clang 14+
-
phpizeandphp-config(fromphp-dev/php8.x-dev) -
GNU Make
-
libpng, libjpeg-turbo, libwebp, FreeType development headers:
- Debian / Ubuntu:
apt install libpng-dev libjpeg-turbo8-dev libwebp-dev libfreetype-dev - RHEL / Fedora:
dnf install libpng-devel libjpeg-turbo-devel libwebp-devel freetype-devel
Probed via pkg-config in
config.m4. plutovg + plutosvg are vendored undervendor/— no install needed. - Debian / Ubuntu:
-
ext/gd is not a runtime requirement. The test suite uses ext/gd in roughly 90 PHPT files to round-trip raster output for pixel inspection; those tests SKIP cleanly when ext/gd isn't available. If you want to run the full suite, build ext/gd once against your PHP install (recipe in AGENTS.md).
Use the GitHub issue tracker. Include:
- PHP version (
php -v) - fastchart version (
php -r 'echo phpversion("fastchart");') - plutovg version (vendored; report the
vendor/plutovg/git hash if known) - Operating system and compiler version
- Minimal reproducing code: the chart class, the setters you called, the data array, and the rendered output (or crash trace) you got vs. expected
- Any error messages, exceptions, or sanitiser output
Before filing, try to reproduce against the latest master branch.
For security issues, do not file a public issue. See SECURITY.md for the private reporting process.
-
Fork and clone the repo.
-
Create a topic branch off
master. -
Make your changes.
-
Add or update tests in
tests/(PHPT format). -
Build clean and run the full suite:
~/php-install-PHP-8.4/bin/phpize ./configure --with-php-config=$HOME/php-install-PHP-8.4/bin/php-config \ --enable-fastchart --enable-fastchart-dev make -j$(nproc) ASAN_OPTIONS=detect_leaks=0 \ TEST_PHP_EXECUTABLE=$HOME/php-install-PHP-8.4/bin/php \ TEST_PHP_ARGS="-d extension=$HOME/php-src-8.4/ext/gd/modules/gd.so \ -d extension=$(pwd)/modules/fastchart.so" \ NO_INTERACTION=1 \ $HOME/php-install-PHP-8.4/bin/php run-tests.php tests/
detect_leaks=0is for the routine local ext/gd sweep when using the ASAN debug PHP build described in AGENTS.md. The CI-style leak check usesdetect_leaks=1and the narrow suppressions file in.github/lsan-suppressions.txt; run that path when validating memory-management changes. For a quick render smoke without ext/gd:~/php-install-PHP-8.4/bin/php \ -d extension=$(pwd)/modules/fastchart.so \ scripts/asan-render-smoke.php
Any
LeakSanitizer: detected memory leaksoutput is a fastchart regression and must be fixed before the PR lands. -
Verify zero compiler warnings (
--enable-fastchart-devadds-Werror -Wextra -Wstrict-prototypes; the release matrix treats any warning as a build failure) and that the full PHPT suite passes. -
Push and open a PR against
master.
- Short imperative subject line (≤ 72 chars).
- Body wraps at 72 columns, explains why not what.
- No
Co-Authored-Bylines. No AI attribution. - Audit the message against
git show --stat HEADbefore pushing. If the subject claims a fix infastchart_axis.c, the diff had better show it.
- Tests use PHPT format. See existing tests under
tests/for shape. - Prefer exact-byte expectations via
--EXPECT--. Use--EXPECTF--only when the output legitimately varies (e.g. line numbers in exception traces). - Pixel-count tests (image-region color counts) need realistic
thresholds: account for thick lines transiting the region, not just
the swatch / fill the test is targeting. See
tests/008_legend.phptandtests/016_legend_position.phptfor the threshold-comment idiom. - Visual regressions: re-render the relevant
docs/examples/*.pngvia the example scripts and eyeball the diff before opening the PR. The gallery is the de-facto visual baseline.
- Tabs for indentation, K&R braces, follows the wider PHP-src convention.
- Comments only when the why is non-obvious. Implementation detail doesn't need a comment; an external-API constraint (e.g. plutosvg's data-URI loader handling only PNG/JPEG) does.
- File headers carry the BSD 3-Clause boxed comment plus an
| Author:line. New files credit yourself there too. - Class registration goes through
fastchart_arginfo.h, generated fromfastchart.stub.phpby~/php-src/build/gen_stub.php. Do not hand-editfastchart_arginfo.h. Run/php-stub-regenafter any stub change. - Memory: use PHP's
emalloc/efreeat the Zend boundary.efree(NULL)is undefined behavior in Zend; keep thefc_efree_optnull-guard wrapper rather than removing it as "dead code". - Truecolor canvas only.
fastchart_require_truecolor()rejects palette images at everydraw()entry. New entry points must call it. - Per-class state lives on the chart's typed C struct
(
fastchart_<name>_obj), not the genericfastchart_obj. Setters parse user input into typed C arrays at setter time;draw()is pure rasterisation.
For maintainers cutting a new version: run /release-ext (or the
/release shim). It reads .release-config, runs the build matrix
(PHP 8.1 through 8.5), tags bare semver, drives the changelog
date-stamping. CHANGELOG follows Keep-a-Changelog; the
PHP_FASTCHART_VERSION literal in php_fastchart.h always holds
the next-to-tag version (no -dev suffix).
By submitting a patch you agree to license your contribution under the same license as the project (BSD 3-Clause).