Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ce7f5f5
PHPUnit 10
Sibyx Jul 29, 2023
3fb1f95
AbstractParserTest removed
Sibyx Jul 29, 2023
0b65bd3
AbstractParserTest removed
Sibyx Jul 29, 2023
b354e1a
Fixed coverage action
Sibyx Jul 29, 2023
569bf80
Fixed PHPUnit annotation warnings
Sibyx Jul 29, 2023
5e8c7a7
Introducing typing in extensions, bounds, routes and tracks
Sibyx Jul 30, 2023
e36c7aa
Getting rid of Summarizable
Sibyx Mar 14, 2024
a1c1360
Removed outdated test files and fixtures.
Sibyx Mar 6, 2026
ed6f253
Consolidate workflows, add documentation, and update project infrastr…
Sibyx Mar 6, 2026
fcac23b
Updated PHPUnit requirements and configuration: allowed broader PHPUn…
Sibyx Mar 6, 2026
6cc0b9c
Broaden PHPUnit version support and update configuration schema to 10.5.
Sibyx Mar 6, 2026
d3b6b9e
Set `fail-fast` to false in CI matrix configuration
Sibyx Mar 6, 2026
f330cc2
Standardize test fixture directory naming convention to align with ca…
Sibyx Mar 6, 2026
13d69c4
Replaced `toArray()` with `jsonSerialize()` across models and tests, …
Sibyx Mar 8, 2026
ed0f383
Getting rid of `GpxSerializable` interface bullshit idea 🤡
Sibyx Mar 8, 2026
11b0937
Add detailed roadmap for `phpGPX 2.x` outlining design principles, im…
Sibyx Mar 8, 2026
79c61d2
Refactor parsers to utilize `AbstractParser` for centralized attribut…
Sibyx Mar 8, 2026
db7749e
Instance based configuration handling (because I wanted it for some r…
Sibyx Mar 8, 2026
5161aef
Computing Engine (saying goodbye to failed Midleware idea) 🚀
Sibyx Mar 8, 2026
9a43028
Refactored Extensions framework 🫣
Sibyx Mar 8, 2026
3fb233d
Remove AbstractExtension, simplify constructors across models, and re…
Sibyx Mar 8, 2026
36067a5
Split test suites into unit and integration for separate coverage rep…
Sibyx Mar 8, 2026
29a344f
Move PointType enum to its own file (PSR-4 autoloading)
Sibyx Mar 8, 2026
2ff3745
add JUnit test result uploads to Codecov 🎯
Sibyx Mar 8, 2026
1c440b8
Moving to mkdocs-material because I hated all other php alternatives …
Sibyx Mar 9, 2026
e0e790b
Update docs workflow to ensure versioning and add version index page 🙃
Sibyx Mar 9, 2026
4b29361
Update docs workflow and mkdocs config: add PlantUML support, edit/vi…
Sibyx Mar 9, 2026
ace167c
Polishing README.md 🍆
Sibyx Mar 9, 2026
cd120b3
Cleaning up before `2.0.0-beta.1` 😜
Sibyx Mar 9, 2026
d7c31b3
Codestyle 🤫
Sibyx Mar 9, 2026
54c8710
Upgrade Codecov actions to v5 and simplify configuration 🎯
Sibyx Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ratings:
- "**.php"
exclude_paths:
- docs/*
- example/*
- examples/*
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, simplexml, libxml
coverage: none

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests
run: vendor/bin/phpunit --configuration phpunit.xml

coverage:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: dom, simplexml, libxml
coverage: xdebug

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run unit tests with coverage
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --testsuite unit --coverage-clover coverage-unit.xml --log-junit junit-unit.xml

- name: Run integration tests with coverage
if: ${{ !cancelled() }}
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --testsuite integration --coverage-clover coverage-integration.xml --log-junit junit-integration.xml

- name: Upload unit coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: coverage-unit.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload integration coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: coverage-integration.xml
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload unit test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: junit-unit.xml
flags: unit
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload integration test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: junit-integration.xml
flags: integration
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
149 changes: 149 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Docs

on:
push:
branches: [develop]
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/docs.yml'
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v6
with:
python-version: '3.12'

- name: Install mkdocs-material
run: pip install mkdocs-material plantuml-markdown

- name: Build and deploy to gh-pages (develop/)
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Fetch gh-pages if it exists
git fetch origin gh-pages:gh-pages 2>/dev/null || true

# Build the site
mkdocs build --strict --site-dir site

# Check out gh-pages (or create orphan)
if git rev-parse --verify gh-pages >/dev/null 2>&1; then
git checkout gh-pages
else
git checkout --orphan gh-pages
git rm -rf .
fi

# Clear develop/ subdirectory and copy new build
rm -rf develop/
cp -r site/ develop/

# Ensure v1 docs exist (copy from master if missing)
if [ ! -d "v1" ]; then
git checkout origin/master -- docs/ 2>/dev/null || true
if [ -d "docs" ]; then
mv docs v1
fi
fi

# Generate version index page
cat > index.html << 'INDEXEOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>phpGPX Documentation</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #fafafa;
color: #333;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.container { max-width: 600px; padding: 2rem; text-align: center; }
h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.tagline { color: #666; margin-bottom: 2.5rem; font-size: 1.1rem; }
.versions { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.version-card {
display: block;
padding: 2rem 2.5rem;
border-radius: 12px;
text-decoration: none;
color: #333;
background: #fff;
border: 2px solid #e0e0e0;
transition: all 0.2s ease;
min-width: 200px;
}
.version-card:hover {
border-color: #009688;
box-shadow: 0 4px 12px rgba(0,150,136,0.15);
transform: translateY(-2px);
}
.version-card .ver { font-size: 1.5rem; font-weight: 700; }
.version-card .badge {
display: inline-block;
padding: 0.15rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
margin-left: 0.4rem;
vertical-align: middle;
}
.badge-stable { background: #e8f5e9; color: #2e7d32; }
.badge-dev { background: #fff3e0; color: #e65100; }
.version-card .desc { color: #888; font-size: 0.9rem; margin-top: 0.5rem; }
.github {
margin-top: 2.5rem;
color: #999;
font-size: 0.85rem;
}
.github a { color: #009688; text-decoration: none; }
.github a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="container">
<h1>phpGPX</h1>
<p class="tagline">A PHP library for reading, creating, and manipulating GPX files</p>
<div class="versions">
<a href="v1/" class="version-card">
<div class="ver">1.x <span class="badge badge-stable">stable</span></div>
<div class="desc">Current release</div>
</a>
<a href="develop/" class="version-card">
<div class="ver">2.x <span class="badge badge-dev">develop</span></div>
<div class="desc">Next major version</div>
</a>
</div>
<p class="github">
<a href="https://github.com/Sibyx/phpGPX">GitHub</a> &middot;
<a href="https://packagist.org/packages/sibyx/phpgpx">Packagist</a>
</p>
</div>
</body>
</html>
INDEXEOF

# Commit and push
git add develop/ index.html
[ -d "v1" ] && git add v1/
git diff --cached --quiet || (git commit -m "Deploy docs from ${GITHUB_SHA::8}" && git push origin gh-pages)
21 changes: 0 additions & 21 deletions .github/workflows/phpunit.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ composer.phar
composer.lock
/vendor/
/.idea/
/phpdocs/
/bin/
.DS_Store?
*.DS_Store
/.php_cs.cache
/.phpunit.result.cache
/.phpunit.cache
coverage.xml
/site/
/.venv/
/.php-cs-fixer.cache
37 changes: 21 additions & 16 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@

<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->ignoreDotFiles(true)
->ignoreVCS(true)
->exclude(['docs', 'vendor'])
->files()
->name('*.php')
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->ignoreDotFiles(true)
->ignoreVCS(true)
->exclude(['docs', 'vendor'])
->name('*.php')
;

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setFinder($finder)
->setRules([
'@PSR2' => true,
])
->setIndent("\t")
;
return (new PhpCsFixer\Config())
->setUsingCache(true)
->setFinder($finder)
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'single_quote' => true,
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'parameters']],
'no_whitespace_in_blank_line' => true,
'no_trailing_whitespace' => true,
])
->setIndent("\t")
;
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 2.0.0-beta.1 : 2025-03-09

### Breaking Changes

- **Changed**: `phpGPX` is now instance-based — `phpGPX::load()` (static) replaced by `(new phpGPX())->load()`
- **Removed**: All static configuration properties (`$CALCULATE_STATS`, `$SORT_BY_TIMESTAMP`, `$PRETTY_PRINT`, etc.) — replaced by `Config` value object and analyzer constructors
- **Removed**: `Summarizable` interface and `toArray()` — replaced by `JsonSerializable` returning GeoJSON (RFC 7946)
- **Removed**: `GpxSerializable` interface — parsers handle XML serialization via Data Mapper pattern
- **Removed**: `StatsCalculator` interface — replaced by Engine
- **Removed**: `AbstractExtension` base class — replaced by `ExtensionInterface`
- **Changed**: Point type constants (`Point::TRACKPOINT`, etc.) replaced by `PointType` enum
- **Changed**: Extension access `$extensions->trackPointExtension` replaced by `$extensions->get(TrackPointExtension::class)`

### Added

- **Added**: Single-pass stats `Engine` with pluggable analyzers (`DistanceAnalyzer`, `ElevationAnalyzer`, `AltitudeAnalyzer`, `TimestampAnalyzer`, `BoundsAnalyzer`, `MovementAnalyzer`, `TrackPointExtensionAnalyzer`)
- **Added**: `Engine::default()` factory with named parameters for common configuration
- **Added**: `ExtensionRegistry` for registering custom extension parsers by namespace URI
- **Added**: `ExtensionInterface` and `ExtensionParserInterface` for custom extensions
- **Added**: `Config` value object for output configuration
- **Added**: `AbstractParser` base class centralizing attribute mapping and XML handling
- **Added**: mkdocs-material documentation site with PlantUML support
- **Added**: Consolidated CI workflow (PHP 8.1–8.4 matrix) with Codecov integration

### Changed

- **Changed**: PHP 8.1+ required
- **Changed**: `Extensions` model is now a keyed collection
- **Changed**: Default Garmin TrackPointExtension v1 + v2 auto-registered via `ExtensionRegistry::default()`
- **Changed**: All parsers refactored to extend `AbstractParser`
- **Changed**: Strict typing on all model properties
- **Changed**: Test suite restructured into `unit` and `integration` suites
- **Changed**: PHPUnit 10+ with attributes (annotations removed)
- **Changed**: Test fixtures standardized under `tests/Fixtures/`

## 1.3.0 : 2023-07-19

Changed minimal PHP version to `^7.1` in `composer.json`. Library still should work with PHP5.5+, if you have troubles
Expand Down
Loading