PHPackages                             bitandblack/idml-json-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bitandblack/idml-json-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bitandblack/idml-json-converter
===============================

Convert Adobe InDesign Markup Language Files (IDML) into JSON and JSON into IDML.

2.3.0(4mo ago)187751MITPHPPHP &gt;=8.2

Since Apr 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/BitAndBlack/idml-json-converter)[ Packagist](https://packagist.org/packages/bitandblack/idml-json-converter)[ Docs](https://www.idml.dev/en/json-idml-converter-php.html)[ Fund](https://www.buymeacoffee.com/tobiaskoengeter)[ RSS](/packages/bitandblack-idml-json-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (8)Used By (0)

[![PHP from Packagist](https://camo.githubusercontent.com/56eb2e0a70d902d33d96cc616aa1792655e30bb9fff2469b6fcff6ce326df861/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626974616e64626c61636b2f69646d6c2d6a736f6e2d636f6e766572746572)](http://www.php.net)[![Total Downloads](https://camo.githubusercontent.com/1774c70485cdd32c66e343d421dee7c24eaf3dedf7c435b9f06e23260b9ce90a/68747470733a2f2f706f7365722e707567782e6f72672f626974616e64626c61636b2f69646d6c2d6a736f6e2d636f6e7665727465722f646f776e6c6f616473)](https://packagist.org/packages/bitandblack/idml-json-converter)[![License](https://camo.githubusercontent.com/c4ff1d4fd04477a8a2feeb893d6ab10a97b368999e385d17107f400d84493e94/68747470733a2f2f706f7365722e707567782e6f72672f626974616e64626c61636b2f69646d6c2d6a736f6e2d636f6e7665727465722f6c6963656e7365)](https://packagist.org/packages/bitandblack/idml-json-converter)

 [ ![Bit&Black Logo](https://camo.githubusercontent.com/6cd6b1b85b6247964059c5d9420aae54482ebf17afbaf5f08127bc49de5916f4/68747470733a2f2f7777772e626974616e64626c61636b2e636f6d2f6275696c642f696d616765732f426974416e64426c61636b2d4c6f676f2d46756c6c2e706e67) ](https://www.bitandblack.com)

Bit&amp;Black IDML-JSON Converter
=================================

[](#bitblack-idml-json-converter)

Convert Adobe InDesign Markup Language Files (IDML) into JSON and JSON into IDML.

Motivation
----------

[](#motivation)

Using this converter allows a **simple handling of IDML** files in PHP.

- **Extracting** information is easy, because you only need to navigate through an array, that holds the whole content of an IDML file.
- **Manipulating** information is easy, because you can change all values by your needs. This allows handling of placeholders, that have been added in Adobe InDesign.

Example
-------

[](#example)

If you want to have a quick look at how the JSON looks like, navigate to the [example](./example) folder and take the [output.json](./example/example1/output.json) file.

Installation
------------

[](#installation)

This library is written in [PHP](https://www.php.net) and made for the use with [Composer](https://packagist.org/packages/bitandblack/idml-json-converter). Be sure to have both of them installed on your system.

Add the library then to your project by running `$ composer require bitandblack/idml-json-converter`.

Usage
-----

[](#usage)

### From command line

[](#from-command-line)

This library comes with two commands that allow the conversion of IDML into JSON and JSON into IDML via CLI.

The CLI is located under [`bin/idml-json-converter`](bin/idml-json-converter) or, if you installed the library as Composer dependency, under `vendor/bin/idml-json-converter`.

Use the command

- `idml:convert:json` to convert an IDML file into JSON.
- `json:convert:idml` to convert a JSON file into IDML.

Add option `-h` to get more information about the usage of a command.

### Custom

[](#custom)

Instead of using the CLI, it is also possible to convert the contents manually.

#### Converting an IDML file

[](#converting-an-idml-file)

Use the [IDML](./src/File/IDML.php) class and initialize it with the path to an IDML. Calling the `getContent()` method will return its content as an array.

```
