Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Kml Parser Laravel Package

plin-code/kml-parser

Parse KML and KMZ files in Laravel to extract placemarks, styles, style maps, and document metadata. Simple installation, configurable namespace and temp directory, with a clean API for reading geographic data.

View on GitHub
Deep Wiki
Context7

Laravel KML Parser is a lightweight package for parsing KML and KMZ files in Laravel applications, turning geographic data into a convenient, ready-to-use format. Install it via Composer, optionally publish the config, and load files directly to access placemarks, styles, style maps, and document metadata.

  • Parses both KML and KMZ archives, with automatic extraction to a configurable temp directory
  • Retrieves placemarks (points of interest), styles, and style maps
  • Exposes document name and description
  • Configurable XML namespace for reliable parsing
  • Simple, framework-friendly API with published configuration
Frequently asked questions about Kml Parser
How do I install plin-code/kml-parser in a Laravel app?
Run composer require plin-code/kml-parser, then publish the config with php artisan vendor:publish --tag=kml-parser-config if you need to customize defaults. The package uses a Laravel service provider and config publishing, so it fits standard Laravel 8+ projects. After publishing, review config/kml-parser.php for namespace and temporary directory settings.
Does plin-code/kml-parser support both KML and KMZ files?
Yes, the package parses KML files and also handles compressed KMZ files by unzipping them internally. That reduces client-side preprocessing for KMZ uploads. KMZ handling relies on Flysystem and the zip extension, so confirm those are available in your deployment.
How do I parse a KML file and retrieve placemarks with plin-code/kml-parser?
Instantiate PlinCode\KmlParser\KmlParser, call loadFromFile with the KML path, then use getPlacemarks to retrieve points of interest. The parser also exposes getStyles, getStyleMaps, getDocumentName, and document description details. The resulting structured data can be transformed into your own models or API responses.
What dependencies and PHP extensions does plin-code/kml-parser need?
The technical evaluation notes reliance on spatie/flysystem for KMZ handling and simplexml for KML parsing. Your server should have the xml, zip, and fileinfo PHP extensions enabled, which are common in Laravel deployments. Check composer.json for exact dependency and PHP version constraints before upgrading.
Can I parse a KMZ file stored in Laravel storage or on S3?
KMZ support is built in and uses Flysystem, so the package is compatible with local, S3, or other configured storage adapters. The evaluation references a storage-based KMZ parsing path, while the README excerpt shows the core parser API. Confirm the current method names in the repository README before wiring it into upload or storage workflows.
What is the output format of parsed KML data and how do I save it to a database?
The package returns structured arrays or objects such as features, coordinates, properties, placemarks, styles, and style maps. It does not automatically persist to your database, so you map the parsed data to Eloquent models, raw SQL, or PostGIS geometry columns yourself. For geospatial querying, PostgreSQL with PostGIS is recommended.
Is plin-code/kml-parser compatible with Laravel 8 and PHP 8?
The technical assessment states the package is tested with Laravel 8+ and requires PHP 8.0+. It follows Laravel-native patterns such as service providers and config publishing. Always verify the exact Laravel and PHP ranges in the package composer.json for your project.
How do I avoid memory issues when parsing large KML or KMZ files?
Large KML/KMZ files are a known performance risk, so test parsing with your expected file sizes before production. Use queue jobs, chunked or streaming parsing where possible, and avoid loading unnecessary data into memory. The evaluation recommends memory optimization and batch processing for heavy geospatial imports.
Does plin-code/kml-parser validate malformed KML or KMZ XML?
There is no built-in KML schema validation for structure correctness, so malformed XML may need custom error handling. Add try/catch logic, logging, retries, or alerts around parsing jobs. For edge cases, validate inputs against the OGC KML specification and test with representative files.
How do I change the default KML namespace or KMZ temp directory?
Publish the package config and edit config/kml-parser.php. The namespace defaults to http://www.opengis.net/kml/2.2, and temp_directory set to null uses the system temporary directory for KMZ extraction. Override those values when your KML tags or storage environment require it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin