kreemer/tmx

Parsing and manipulating tmx files

v0.3.1 2021-03-16 19:57 UTC

This package is auto-updated.

Last update: 2024-04-07 18:57:15 UTC


README

Total Downloads Latest Stable Version Code Coverage

TMX is a library for creating, parsing and editing tmx files. The main purpose is to parse a tmx file and save the parsed file as image file.

The tmx format is used by the program Tiled. The format is explained here.

Installation

Install the latest version with

$ composer require kreemer/tmx

Basic Usage

<?php

use Tmx\Service\Parser;
use Tmx\Service\Printer;

$parser = new Parser();
$map = $parser->parse('filename.tmx');

echo $map->getWidth(); // get width of map
echo $map->getHeight(); // get height of map

$printer = new Printer();
$printer->print($map, 'output.png'); // save map to output.png

Documentation

See here for additional documentation.

About

Requirements

  • Tmx works with PHP 7.4 or above.
  • You have to install the imagick extension, gd support is currently under development
  • If you want to parse zlib or zstd compressed maps, you have to install these extensions

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Attribution

This library uses Serene village revamped tiles for automatic tests. The tileset is under the Creative commons license.

Please support the original developer for this wonderful tileset.

License

Tmx is licensed under the MIT License - see the LICENSE file for details.