A library to manipulate KML/KMZ files

v1.0.1 2024-02-24 01:27 UTC


Donate Latest Version on Packagist GitHub Tests Action Status Total Downloads License

A php library to parse KML/KMZ files.

php-libKML maps KML/KMZ data into PHP objects that follow the KML specification. The purpose of the library is to create KML file from code, parse KML files and convert to another format maintaining the complete KML information.


  • KML schema version 2.2
  • PHP 7.4+
  • Composer integration
  • Object oriented design
  • Comprehensive KML model
  • Import
    • KML

Future features:

  • Google extensions support
  • Import
    • KMZ
    • GeoJson
  • Export
    • KML/KMZ
    • GeoJson
    • WKT


You can install the package via composer:

composer require simonschaufi/php-libkml


$kmlReader = new KmlReader();
$kmlDocument = $kmlReader->fromString($kml);
// or
$kmlDocument = $kmlReader->fromKmlFile($kmlFilePath);


Pull Requests are gladly welcome!

Please remember to add an issue and connect it to your pull requests. It is very helpful to understand what kind of issue the PR is going to solve.


Please describe what kind of bug your fix solves and give us feedback on how to reproduce the issue. We're going to accept only bugfixes if we can reproduce the issue.

Execute unit tests:

composer local:tests:unit

Execute acceptance tests:

composer local:tests:acceptance



The MIT License (MIT). Please see License File for more information.