Skip to content

feat: add facades for parsers and generators#160

Open
studnitz wants to merge 1 commit intomainfrom
feature/add-facades
Open

feat: add facades for parsers and generators#160
studnitz wants to merge 1 commit intomainfrom
feature/add-facades

Conversation

@studnitz
Copy link
Member

@studnitz studnitz commented Feb 4, 2026

Summary

  • Add Laravel facades for parser and generator classes, allowing direct static method calls instead of using app()->make()
  • Register generator classes as singletons in the service provider
  • Add comprehensive tests for all facades

New Facades:

Facade Underlying Class
WKBParser WKBParser
WKTParser WKTParser
GeojsonParser GeojsonParser
WKBGenerator WKBGenerator
WKTGenerator WKTGenerator
GeojsonGenerator GeojsonGenerator

Before:

$wkbParser = app()->make(WKBParser::class);
$wkbParser->parse($something);

After:

WKBParser::parse($something);

Closes #110

Test plan

  • All existing tests pass (620 tests)
  • New facade tests added and passing
  • Verify facades work in a real Laravel application

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added dedicated facades for parsing geometry formats: WKB, WKT, and GeoJSON.
    • Added dedicated facades for generating geometry formats: WKB, WKT, and GeoJSON.
    • Replaced unified facade with granular, format-specific aliases for improved developer experience.

@studnitz studnitz requested a review from saibotk February 4, 2026 23:49
Add Laravel facades for easier access to parser and generator classes,
eliminating the need for app()->make() boilerplate.

New facades:
- WKBParser, WKTParser, GeojsonParser (for parsing)
- WKBGenerator, WKTGenerator, GeojsonGenerator (for generating)

Closes #110

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@studnitz studnitz force-pushed the feature/add-facades branch from 46dd02a to a35b03c Compare February 4, 2026 23:52
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This PR introduces six new Laravel facades (WKBParser, WKTParser, GeojsonParser, WKBGenerator, WKTGenerator, GeojsonGenerator) to replace the single generic Magellan facade, enabling simpler static API calls. The old facade alias is removed from configuration, and the new facades are registered in the service provider.

Changes

Cohort / File(s) Summary
Parser Facades
src/Facades/WKBParser.php, src/Facades/WKTParser.php, src/Facades/GeojsonParser.php
Three new facade classes extending Illuminate\Support\Facades\Facade, each delegating to their respective base parser (BaseWKBParser, BaseWKTParser, BaseGeojsonParser) via getFacadeAccessor(). Includes docblock declarations of static methods for IDE support.
Generator Facades
src/Facades/WKBGenerator.php, src/Facades/WKTGenerator.php, src/Facades/GeojsonGenerator.php
Three new facade classes extending Illuminate\Support\Facades\Facade, each delegating to their respective base generator (BaseWKBGenerator, BaseWKTGenerator, BaseGeojsonGenerator) via getFacadeAccessor(). Includes docblock declarations of static methods for geometry generation and PostGIS SQL operations.
Configuration
composer.json
Replaced single alias "Magellan": "Clickbar\Magellan\Facades\Magellan" with six new aliases mapping parser and generator names to their corresponding facade classes.
Service Registration
src/MagellanServiceProvider.php
Added imports and three new singleton bindings in registeringPackage() to register GeojsonGenerator, WKTGenerator, and WKBGenerator instances.
Test Coverage
tests/Facades/FacadeTest.php
New test file validating parsing and generation of geometric objects through all six facades, including WKT/WKB/GeoJSON parsing and generation with SRID and coordinate handling verification.
Documentation
CHANGELOG.md
Added unreleased entry documenting the new parser and generator facades.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Six facades now hop with glee,
No more boilerplate to see!
Parse and generate with static flair,
Geometry made light as air.
From one facade to six so bright,
The API feels just right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add facades for parsers and generators' directly and clearly describes the main change: introducing facades for parser and generator classes as per the PR objectives.
Linked Issues check ✅ Passed The PR fully addresses issue #110 by adding facades (WKBParser, WKTParser, GeojsonParser, WKBGenerator, WKTGenerator, GeojsonGenerator) enabling static method calls instead of app()->make() boilerplate.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the requested facades: facade classes, service provider bindings, composer.json alias registration, tests, and changelog documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-facades

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more facades

1 participant

Comments