Download the PHP package iliaal/fastchart without Composer

On this page you can find all versions of the php package iliaal/fastchart. 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 fastchart

fastchart

Tests Version License: BSD-3-Clause Follow @iliaa

Native C PHP extension. 38 chart types behind a modern OO API with fluent setters and final classes. Line, area, bar, scatter, bubble, pie, radar, polar, surface, contour, gauge, gantt, box-plot, treemap, funnel, waterfall, heatmap, linear meter, network / chord / arc graphs, circle packing, violin and population pyramids, Venn, word clouds, pictograms, serpentine timelines, plus a deep StockChart (seven candle styles, SMA / EMA / WMA overlays, volume + indicator panes).

SVG is the canonical render format. PNG / JPG / WebP outputs flatten text to glyph paths, run plutovg over the resulting SVG, and encode the RGBA buffer with libpng / libjpeg-turbo / libwebp. The same chart object serves a sharp <svg> for dashboards or a PNG for emails without rebuilding state. renderToFile() picks the encoder from the extension; renderPng() / renderJpeg() / renderWebp() / renderSvg() return bytes in-process.

Live gallery →. Side-by-side SVG / PNG / JPG / WebP renders for every chart family, with the source PHP shown above each row.

Status

v1.6.0 (current): 38 chart classes plus a 2-class Symbol family, vector PDF output (renderPdf, opt-in --with-pdfio), PNG compression control, SVG fragment id prefixes, and HTML image-map hot-spots on Bar / Pie / Scatter (setImageMap + getImageMap). v1.0 dropped libgd as a runtime dependency, rebuilt rasterization around vendored plutovg, and replaced draw($canvas) with renderSvg/Png/Jpeg/Webp + renderToFile. See CHANGELOG.md for the full history.

Install

Via PIE (recommended)

PIE handles the configure / make / install cycle for you against your active PHP install:

PIE picks up the latest tagged release from Packagist and respects your platform's pkg-config for the FreeType / libpng / libjpeg-turbo / libwebp probes. After install, enable the extension via your distribution's mechanism (e.g. docker-php-ext-enable fastchart on the official PHP images, or add extension=fastchart to php.ini).

From source

Build manually against the PHP install you want to extend:

Strict-warnings dev build (recommended for contributors):

Runtime check:

Requirements

Quick start

The shortest path is the renderToFile() helper, which picks the encoder from the file extension:

renderPng(), renderJpeg(), and renderWebp() return the encoded bytes if you need them in memory. Raster compression knobs:

PNG is always lossless; setPngCompressionLevel() trades encode time for file size. The encoder is libpng with a fixed row filter tuned for chart-shaped content.

WebP has four encoder modes selectable via setWebpMode(). The default WEBP_DRAWING is tuned for chart-shaped content (flat fills, sharp edges); see the table in docs/examples/50_webp_modes.php for the speed/size trade-offs each mode picks.

Raster memory: the physical canvas (setSize() × setDpi()/96) is capped at 16384 px per dimension and 64M pixels total. Peak raster memory is one RGBA frame counted against PHP's memory_limit, plus encoder workspace. At the 64M-pixel cap the frame is ~256 MiB. Use the fastchart.max_render_pixels INI (PHP_INI_SYSTEM, default 67108864) to enforce a lower per-render pixel ceiling process-wide — renders above it throw ValueError before any frame buffer is allocated.

Call renderSvg() on the same chart object for vector output: dashboards, print, anywhere infinite-zoom matters.

Construction is identical for every output format; only the final render call differs. By default, SVG text is flattened to glyph outline paths (SVG_TEXT_PATHS mode). The resulting SVG is self- contained and renders identically in any viewer or rasterizer. For smaller files with selectable text, switch to native <text> mode:

Raster outputs (PNG/JPG/WebP) always use the PATHS mode internally; plutovg has no text support of its own, so glyph flattening is what makes labels appear in the rasterized output.

PDF is a second vector format, available when the extension is built with --with-pdfio (it links a system pdfio; off by default). Chart bodies emit PDF path operators directly, no rasterization, so every chart class renders as sharp vector output:

Without --with-pdfio, both methods throw "PDF support not compiled in". This first cut falls back to solid fills for gradients, omits raster background images, and flattens alpha against the page background. Stacked translucent overlaps won't match SVG/raster exactly because the current pdfio API doesn't expose per-shape transparency.

On Windows, the PDF backend is opt-in via --with-pdfio (config.w32) and requires pdfio.h / pdfio.lib to be provisioned first; the Windows CI and prebuilt DLLs ship PDF-disabled.

Three static methods on FastChart\Chart rasterize caller-supplied SVG bytes through the same plutovg + libpng / libjpeg-turbo / libwebp pipeline. Useful for round-tripping renderSvg() output, or for stitching multiple drawSvgFragment() calls into one outer SVG and rasterizing the result, all in-process. When stitching, pass each fragment a distinct drawSvgFragment($idPrefix) so gradient and clip-path ids from different charts can't collide:

Output dimensions come from the SVG's width / height / viewBox. SVG <text> elements render blank because plutovg has no text engine, so text must be path-flattened first (fastchart's own SVG builder does this automatically). See docs/examples/51_svg_to_raster.php for a runnable demo and docs/specs/svg-to-raster.md for the full contract.

📊 Performance

Median in-memory render time at 1920×1080 on a single core (Intel i9-13950HX, PHP 8.4 release build NTS -O2, default font + DPI). SVG is the canonical output; PNG / WebP / JPG go through the same SVG build, then plutosvg + plutovg rasterize, then the format encoder (libpng / libwebp / libjpeg-turbo). The raster columns therefore add the rasterize cost on top of the SVG-only number.

Chart SVG ms PNG ms WebP ms JPG ms
AreaChart 0.12 45.19 34.04 11.45
BarChart 0.22 43.54 35.18 12.35
BoxPlot 0.09 40.26 30.74 9.95
BubbleChart 0.06 52.84 44.18 14.84
ContourChart 0.11 48.46 41.14 12.97
Funnel 0.08 40.15 31.59 9.53
GanttChart 0.12 40.08 30.98 10.22
GaugeChart 0.02 44.75 33.78 10.19
Heatmap 0.05 43.28 35.62 11.85
LineChart 0.11 45.45 37.23 11.81
LinearMeter 0.02 38.64 29.10 8.98
PieChart 0.06 44.42 33.84 11.75
PolarChart 0.02 47.60 37.10 11.48
RadarChart 0.06 47.89 36.48 13.39
ScatterChart 0.11 43.05 32.48 10.38
StockChart 0.20 46.00 40.86 14.19
SurfaceChart 0.06 40.09 34.50 10.35
Treemap 0.11 39.76 31.74 9.74
Waterfall 0.09 39.21 32.05 10.08

SVG stays well under a quarter-millisecond across the board (0.02 to 0.22 ms) because there's no rasterization; the backend appends strings into a smart_str via an allocation-free integer/fraction number emitter. The raster encoders split into three bands: JPG fastest (9-15 ms, libjpeg-turbo with 4:2:0 subsampling + SSSE3/NEON RGBA-pack), WebP middle (29-44 ms, libwebp with WEBP_PRESET_DRAWING + method=2 + multi-thread), PNG slowest (38-53 ms, libpng's deflate dominates). All four formats stay under 55 ms at 1080p on one thread.

These numbers reflect the optimization series in v1.1.x (allocation-free SVG number formatting, glyph outline cache, opaque-detect un-premultiply with SSSE3/NEON shuffle, deferred text overlays, larger FT raster pool); see optimization.md for the per-finding breakdown.

Repro the numbers locally:

Iteration count via FC_BENCH_ITERS (default 50). Bench source at docs/bench/bench.php.

What you can render

38 chart classes plus a 2-class symbology family, all under the FastChart\ namespace. Each name links to its rendered example image:

Cross-cutting features available on most chart types:

Examples

A gallery of code + rendered chart pairs lives in docs/README.md. Sixty-six runnable scripts in docs/examples/ regenerate the images and exercise every public method on the API surface.

Public classes

All under the FastChart\ namespace:

Every setter returns static, so a single fluent expression configures and emits a chart.

The Symbol family lives parallel to Chart (no shared base, since axes / palettes / plot rect have no meaning for a barcode):

🔗 Native PHP extensions

Companion native PHP extensions:

License

BSD 3-Clause for the extension itself; see LICENSE. Vendored third-party code (all MIT):

SPDX: (BSD-3-Clause AND MIT).


Follow @iliaa on XBlog • If this saved you a chart-rendering microservice, ⭐ star it!


All versions of fastchart with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 iliaal/fastchart contains the following files

Loading the files please wait ...