PHPackages                             mapsight/pulp-gtfs - 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. mapsight/pulp-gtfs

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

mapsight/pulp-gtfs
==================

GTFS helpers for Pulp pipelines.

00PHP

Since Jun 18Pushed todayCompare

[ Source](https://github.com/open-mapsight/pulp-gtfs)[ Packagist](https://packagist.org/packages/mapsight/pulp-gtfs)[ RSS](/packages/mapsight-pulp-gtfs/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Pulp GTFS
=========

[](#pulp-gtfs)

GTFS helpers for Pulp pipelines, currently focused on generating clean GeoJSON for stops and lines.

Features
--------

[](#features)

- **Static GTFS input:** Reads standard extracted GTFS `.txt` files from a directory.
- **Stops GeoJSON:** Creates point features from `stops.txt`.
- **Lines GeoJSON:** Creates representative route geometries from `routes.txt`, `trips.txt`, and `shapes.txt`.
- **Bounding box filtering:** Limits output to stops inside a configured `[minLon, minLat, maxLon, maxLat]` bbox.
- **Line enrichment:** Adds served lines and modes to stop features.
- **Accessibility enrichment:** Maps `wheelchair_boarding` into normalized and legacy properties.
- **Presentation-neutral output:** Emits source/data properties only; applications can add icons, HTML descriptions, and other presentation fields afterwards.

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

[](#installation)

```
composer require mapsight/pulp-gtfs
```

This package depends on `mapsight/pulp`.

Usage
-----

[](#usage)

Supported output types:

- `stops`
- `lines`
- `combined`

Download, cache, and extract GTFS data before running the handler. The handler expects files like `routes.txt`, `stops.txt`, `trips.txt`, `stop_times.txt`, and `shapes.txt` to pass through the pipeline.

```
use OpenMapsight\Pulp;
use OpenMapsight\PulpGeoJSON;
use OpenMapsight\PulpGTFS;
use OpenMapsight\PulpJSON;

$gtfsDirectory = __DIR__ . '/cache/gtfs-extracted';

Pulp::start()
    ->pipe(Pulp::src('.*\.txt', $gtfsDirectory))
    ->pipe(Pulp::split(
        static fn(Pulp $p): Pulp => $p->pipe(PulpGTFS::geoJson(
            'stops',
            'https://example.com/open-data-docs',
            [10.42, 52.18, 10.65, 52.36],
            null,
            'GTFS',
            'https://example.com/open-data-docs',
            'https://example.com/open-data-docs',
        )),
        static fn(Pulp $p): Pulp => $p->pipe(PulpGTFS::geoJson(
            'lines',
            'https://example.com/open-data-docs',
            [10.42, 52.18, 10.65, 52.36],
            null,
            'GTFS',
            'https://example.com/open-data-docs',
            'https://example.com/open-data-docs',
        )),
    ))
    ->pipe(PulpGeoJSON::calculateBBoxes())
    ->pipe(PulpGeoJSON::addBuildInfo())
    ->pipe(PulpJSON::encodeJSON(JSON_PRETTY_PRINT))
    ->pipe(Pulp::dest(__DIR__ . '/result'))
    ->run();
```

If your extracted files use different names, pass a file map:

```
PulpGTFS::geoJson('combined', $sourceUrl, $bbox, options: [
    'files' => [
        'routes' => 'my-routes.csv',
        'stops' => 'my-stops.csv',
        'stopTimes' => 'my-stop-times.csv',
        'trips' => 'my-trips.csv',
        'shapes' => 'my-shapes.csv',
    ],
])
```

Handler Arguments
-----------------

[](#handler-arguments)

`PulpGTFS::geoJson(...)` accepts:

- `type`: one of `stops`, `lines`, or `combined`.
- `sourceUrl`: The public or internal source URL used for metadata.
- `bbox`: `[minLon, minLat, maxLon, maxLat]`.
- `departuresBaseUrl`: Optional base URL for live departure data. When set, stop features get `departuresUrl`.
- `sourceName`: Human-readable source name in feature properties and collection metadata.
- `documentationUrl`: Public documentation URL in collection metadata.
- `publicSourceUrl`: Public source URL written to feature properties and collection metadata. Use this when the actual `sourceUrl` contains a private token.

Stop Properties
---------------

[](#stop-properties)

Stop features include:

- `gtfsStopId`
- `name`
- `lines`
- `routeIds`
- `modes`
- `modeLabels`
- `wheelchairBoarding`
- `wheelchairBoardingLabel`
- `wheelchairAccessible`
- `stopCode`
- `parentStation`
- `departuresUrl` when configured

Line Properties
---------------

[](#line-properties)

Line features include:

- `gtfsRouteId`
- `gtfsShapeId`
- `name`
- `line`
- `mode`
- `modeLabel`
- `routeType`
- `routeShortName`
- `routeLongName`
- `routeUrl`
- `stroke` when `route_color` is present

Accessibility Mapping
---------------------

[](#accessibility-mapping)

GTFS `wheelchair_boarding` is mapped as:

- `1`: `wheelchairBoarding = yes`, `wheelchairBoardingLabel = accessible`
- `2`: `wheelchairBoarding = no`, `wheelchairBoardingLabel = not accessible`
- `0` or missing: `wheelchairBoarding = unknown`, `wheelchairBoardingLabel = unknown`

If a stop has no explicit value, the parent station value is used when available.

Notes
-----

[](#notes)

- The line output picks one representative shape per route based on the most common shape among trips serving stops in the bbox.
- The handler streams large GTFS text files and avoids loading complete statewide `trips.txt`, `stop_times.txt`, or `shapes.txt` tables into memory.
- Keep tokenized or licensed GTFS URLs out of generated public GeoJSON by passing a safe `publicSourceUrl`.
- Add app-specific fields such as `mapsightIconId`, `listInformation`, or HTML `description` in the consuming project, not in this generic package.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/684458?v=4)[Paul Golmann](/maintainers/pjeweb)[@pjeweb](https://github.com/pjeweb)

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![pjeweb](https://avatars.githubusercontent.com/u/684458?v=4)](https://github.com/pjeweb "pjeweb (1 commits)")

### Embed Badge

![Health badge](/badges/mapsight-pulp-gtfs/health.svg)

```
[![Health](https://phpackages.com/badges/mapsight-pulp-gtfs/health.svg)](https://phpackages.com/packages/mapsight-pulp-gtfs)
```

###  Alternatives

[gonoware/laravel-maps

Maps for your Laravel application

1728.0k](/packages/gonoware-laravel-maps)

PHPackages © 2026

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