PHPackages                             vincjo/spatialite - 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. [Database &amp; ORM](/categories/database)
4. /
5. vincjo/spatialite

ActiveLibrary[Database &amp; ORM](/categories/database)

vincjo/spatialite
=================

PHP + Spatialite

0.0.7(6y ago)5764↓100%LGPL-2.1PHPPHP &gt;=7.3

Since Oct 16Pushed 6y ago2 watchersCompare

[ Source](https://github.com/vincjo/spatialite)[ Packagist](https://packagist.org/packages/vincjo/spatialite)[ RSS](/packages/vincjo-spatialite/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

Install
=======

[](#install)

> Note that you have to install first sqlite3 / mod\_spatialite and spatialite to run this library.

`composer require vincjo/spatialite`

Tests
=====

[](#tests)

`./vendor/bin/phpunit tests`

Basic usage
===========

[](#basic-usage)

Create a new empty DB :

```
use Spatialite\SPL;

$db = new SPL( SPL::CreateNewEmptyDB('test.sqlite') );

// Or connect an existing Spatialite DB :
$db = new SPL( 'path/to/mydb.sqlite' );
```

Load shapfile :

```
$db->loadShapefile('path/to/shapefile/commune', 'commune', [
    'srid' => 2154,
    'charset' => 'UTF-8'
]);
```

Query :

```
$result = $db->query("
    SELECT numero, nom_acc, statut, AsText( ST_Centroid(geom) ) AS centroid
    FROM commune
    LIMIT 3
")->fetchAll(SPL::FETCH_OBJ);

// output :
Array
(
    [0] => stdClass Object
        (
            [numero] => 71176
            [nom_acc] => Digoin
            [statut] => Chef-lieu de canton
            [centroid] => POINT(778668.545898 6599300.563594)
        )

    [1] => stdClass Object
        (
            [numero] => 71590
            [nom_acc] => Volesvres
            [statut] => Commune simple
            [centroid] => POINT(789596.3737 6597690.519251)
        )

    [2] => stdClass Object
        (
            [numero] => 71325
            [nom_acc] => La Motte-Saint-Jean
            [statut] => Commune simple
            [centroid] => POINT(773591.803208 6602067.726544)
        )

)
```

Dump shapefile :

```
$db->dumpShapefile('./shapefile', 'commune', [
    'charset' => 'UTF-8',
    'geomcolumn' => 'geom'
]);
```

About Spatialite
================

[](#about-spatialite)

SpatiaLite implements spatial extensions following the specification of the Open Geospatial Consortium (OGC).
At a very basic level, a DBMS that supports Spatial Data offers an SQL environment that has been extended with a set of geometry types, and thus may be usefully employed i.e. by some GIS application.
A geometry-valued SQL column is implemented as a column that has a geometry type. The OGC specification describe a set of SQL geometry types, as well as functions on those types to create and analyze geometry values.

[**SpatiaLite 4.2.0 - SQL functions reference list**](http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html)

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64% 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 ~23 days

Recently: every ~28 days

Total

7

Last Release

2208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fc6508a271b39117006ef443e5e946d51e93a541efbc4075e66898fc5a2a40c?d=identicon)[vincjo](/maintainers/vincjo)

---

Top Contributors

[![vincjo](https://avatars.githubusercontent.com/u/37813278?v=4)](https://github.com/vincjo "vincjo (16 commits)")[![cd71-mthd](https://avatars.githubusercontent.com/u/56715502?v=4)](https://github.com/cd71-mthd "cd71-mthd (9 commits)")

---

Tags

phpsqlitesqlite3spatialite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vincjo-spatialite/health.svg)

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

###  Alternatives

[vcian/laravel-db-auditor

Database DB Auditor provide leverage to audit your MySql,sqlite, PostgreSQL database standards and also provide options to add constraints in table.

28534.0k1](/packages/vcian-laravel-db-auditor)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.1k9](/packages/popphp-pop-db)[moxio/sqlite-extended-api

Exposes SQLite APIs that are otherwise not available in PHP

198.1k](/packages/moxio-sqlite-extended-api)

PHPackages © 2026

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