PHPackages                             hannesvdvreken/pip - 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. hannesvdvreken/pip

ActiveLibrary

hannesvdvreken/pip
==================

The Polygon class

1.1.0(5y ago)1738.5k↓50%4[1 issues](https://github.com/hannesvdvreken/pip/issues)1MITPHPPHP &gt;=5.6.0

Since Sep 8Pushed 5y ago2 watchersCompare

[ Source](https://github.com/hannesvdvreken/pip)[ Packagist](https://packagist.org/packages/hannesvdvreken/pip)[ RSS](/packages/hannesvdvreken-pip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (1)

Polygon tools
=============

[](#polygon-tools)

[![Build Status](https://camo.githubusercontent.com/e47d17cf3a3651c6e018395b5c282c7733adf9144fe970eb0f3c0973649e3ea2/68747470733a2f2f7472617669732d63692e6f72672f68616e6e657376647672656b656e2f7069702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/hannesvdvreken/pip)

A [point-in-polygon algorithm](http://en.wikipedia.org/wiki/Point_in_polygon), centroid and orientation calculation, written in PHP. Figure out (pun) if a point is actually inside a convex or concave polygon.

Usage
-----

[](#usage)

Initiate a Polygon object with coordinates as specified in [the GeoJSON Format](http://www.geojson.org/geojson-spec.html#polygon). An array of latitude, longitude pairs.

```
$coords = [
    [51.046945330263, 3.7388005491447],
    [50.884119340619, 4.7054353759129],
    [51.260385196697, 4.3696193284848],
];

$poly = new \Geometry\Polygon($coords);

$coords = $poly->getOutline();
$poly->setOutline($coords);

$centroid = $poly->centroid();
echo "the centroid of the polygon is ($centroid[0], $centroid[1]).\n";

if ($poly->isValid()) {
    echo "the polygon was succesfully created.\n";
}

if (!$poly->isClockwise()) {
    echo "the points define a counter-clockwise polygon.\n";
}

if ($poly->pip($x, $y)) {
    echo "the polygon includes ($x,$y).\n";
}
```

Origin
------

[](#origin)

Written during Apps For Ghent, 2012.

License
-------

[](#license)

[MIT](license)

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1237 days

Total

3

Last Release

2151d ago

Major Versions

v0.0.2 → 1.0.02014-11-13

PHP version history (3 changes)v0.0.2PHP &gt;=5.3.0

1.0.0PHP &gt;=5.4.0

1.1.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9937cd6d2eff58e99c75bc2d4a53066e7c9cfdec457c798d5d02d37e6947f419?d=identicon)[hannesvdvreken](/maintainers/hannesvdvreken)

---

Top Contributors

[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (25 commits)")

---

Tags

geometrygeoPolygongeojsonpoint in polygonpip

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hannesvdvreken-pip/health.svg)

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

###  Alternatives

[mjaschen/phpgeo

Simple Yet Powerful Geo Library

1.6k8.6M22](/packages/mjaschen-phpgeo)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[jmikola/geojson

GeoJSON implementation for PHP

3109.0M77](/packages/jmikola-geojson)[jsor/doctrine-postgis

Spatial and Geographic Data with PostGIS and Doctrine.

2191.6M1](/packages/jsor-doctrine-postgis)[geokit/geokit

Geo-Toolkit for PHP

251924.7k6](/packages/geokit-geokit)[brick/geo

GIS geometry library

245862.1k13](/packages/brick-geo)

PHPackages © 2026

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