PHPackages                             alto/bezier - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alto/bezier

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alto/bezier
===========

Precision PHP toolkit for evaluating, splitting, and measuring quadratic, cubic, quintic and N-order Bezier curves

v1.0.0(4mo ago)10MITPHPPHP &gt;=8.3.0CI passing

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/PhpAlto/bezier)[ Packagist](https://packagist.org/packages/alto/bezier)[ Docs](https://github.com/phpalto/bezier)[ GitHub Sponsors](https://github.com/sponsors/smnandre)[ RSS](/packages/alto-bezier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Alto Bezier
===========

[](#alto-bezier)

Alto\\Bezier is a precision PHP toolkit for evaluating, splitting, and measuring quadratic, cubic, quintic, and N-order Bézier curves using immutable value objects and a numerically stable De Casteljau core.

Features
--------

[](#features)

- Quadratic, cubic, quartic, quintic, and arbitrary N-order curves that all share the same API
- Point evaluation: `pointAt(t)` and constant-speed `pointAtDistance(distance)` helpers
- Curve subdivision with `split(t)` for tessellation or editing workflows
- Differential geometry helpers: derivatives, tangents, normals
- Arc-length calculation and arc-length parameterization with configurable sampling
- Intersection detection between any two curves
- Bounding boxes and evenly spaced point generators for export to SVG, canvas, or WebGL
- Immutable, readonly classes with no external dependencies

Installation
------------

[](#installation)

```
composer require alto/bezier
```

Usage
-----

[](#usage)

### Create and inspect a cubic curve

[](#create-and-inspect-a-cubic-curve)

```
use Alto\Bezier\CubicCurve;
use Alto\Bezier\Point;

$curve = new CubicCurve(
    new Point(0, 0),
    new Point(40, 160),
    new Point(160, -40),
    new Point(200, 120)
);

$mid = $curve->pointAt(0.5);
[$left, $right] = $curve->split(0.4);
$heading = $curve->tangent(0.5);
```

### Instantiate quadratic and N-order curves

[](#instantiate-quadratic-and-n-order-curves)

```
use Alto\Bezier\QuadraticCurve;
use Alto\Bezier\NOrderCurve;
use Alto\Bezier\Point;

$quadratic = new QuadraticCurve(
    new Point(0, 0),
    new Point(50, 120),
    new Point(120, 0)
);

$wave = new NOrderCurve(...array_map(
    fn(int $i) => new Point($i * 20, sin($i / 2) * 40 + 60),
    range(0, 7)
));
```

### Exporting control points to SVG

[](#exporting-control-points-to-svg)

```
$path = sprintf(
    'M %s C %s %s %s',
    ...array_map(fn(Point $p) => $p->x.' '.$p->y, $curve->toArray())
);
```

Advanced
--------

[](#advanced)

- **Arc length &amp; constant-speed motion**: `length($samples)` returns the numerical arc length, while `pointAtDistance($distance, $samples)` maps real distances back to coordinates.
- **Intersections**: `$curveA->intersections($curveB, tolerance: 0.25, maxDepth: 18)` delivers intersection points along with their `t` parameters on each curve.
- **Numeric tuning**: increase sampling (default 100) for long or intricate paths to improve accuracy for arc-length and parameterization routines.
- **Bounding boxes and grids**: `boundingBox()` exposes width/height/corners, and `points($interval)` streams evenly spaced points for tessellation or hit-testing.

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpstan analyse
vendor/bin/phpunit
```

License
-------

[](#license)

This project is licensed under the [MIT License](./LICENSE).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance77

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

128d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8951d49b371d210280a58ce48969a07d1f49924810f8a1fab3a9343eb46fdc9?d=identicon)[simonandre](/maintainers/simonandre)

---

Top Contributors

[![smnandre](https://avatars.githubusercontent.com/u/1359581?v=4)](https://github.com/smnandre "smnandre (1 commits)")

---

Tags

bezierbezier-curvecubiccurvespathphpphp-svgquadraticquinticsvggraphicssvgmathgeometrycurvecubiccomputational-geometrybezierbezier-curvequadraticcurve-splittingcurve-evaluation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alto-bezier/health.svg)

```
[![Health](https://phpackages.com/badges/alto-bezier/health.svg)](https://phpackages.com/packages/alto-bezier)
```

###  Alternatives

[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[components/flag-icon-css

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.0k1.6M23](/packages/components-flag-icon-css)[twbs/bootstrap-icons

Official open source SVG icon library for Bootstrap

7.9k2.0M56](/packages/twbs-bootstrap-icons)[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.1M40](/packages/markrogoyski-math-php)[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

1.1k4.5M5](/packages/kartik-v-bootstrap-star-rating)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
