PHPackages                             prometee/php-idml - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. prometee/php-idml

AbandonedArchivedLibrary[File &amp; Storage](/categories/file-storage)

prometee/php-idml
=================

A simple class to handle file management of Adobe InDesign IDML files.

15.1k3PHP

Since Jan 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Prometee/php-idml)[ Packagist](https://packagist.org/packages/prometee/php-idml)[ RSS](/packages/prometee-php-idml/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-idml
--------

[](#php-idml)

A simple class to handle file management of Adobe InDesign IDML files. Keeping track of all the individual files within an `.idml` package is a chore. This helps a bit. (A *bit*.)

### Installation

[](#installation)

```
composer require prometee/php-idml

```

#### Usage

[](#usage)

Instantiate the object:

```
require __DIR__.'/../vendor/autoload.php';
$idml = new \IDML\Package();
$idml->setZip("filename.idml")
$idml->load();

```

This will unzip `filename.idml` to a directory called `.filename.idml`. This directory will be deleted when the object is garbage-collected (see the `__destruct()` method). Alternatively, if you keep your IDMLs stored unzipped, a directory can also be passed to the constructor:

```
require __DIR__.'/../vendor/autoload.php';
$idml = new \IDML\Package();
$idml->setDirectory("/path/to/idml/");
$idml->load();

```

This directory will not be deleted upon object destruction. (Admittedly this is not a typical use-case but happened to be how the project I was working on stored things.)

The `IDML\Package` object is essentially a file manager/server of `DOMDocument` objects for all the internal files. That's most of what this class does.

```
$spreads = $idml->getSpreads();
$storyu12a = $idml->getStory("u12a");
$backingStory = $idml->getBackingStory();
// etc

```

Generally if you want Whatever, use `getWhatever()`. You likely won't need to use any of the setters but they're there if you want to do something weird. Note `getSpread()` is a convenience method that gets the first spread, operating under the assumption that there is only one. This applied to the project from which this class was born, but may not apply to yours. This method is also used in the `addElementToSpread()` method if a spread is not explicitly provided. Use caution.

#### Notable Methods

[](#notable-methods)

These are just the most generic methods that existed in the project-specific version of this class. I have put zero effort into trying to make this a generically useful class.

- `getLayers($selfsOnly, $visibleOnly)`: Returns an array of layers from the `designmap.xml` of this IDML. It can either return the layer elements (`DOMNodes`) or the self attributes (e.g. "u12a") of the layers. The `$visibleOnly` flag determines whether non-visible layers should be included.
- `getElementBySelfAttribute($self)`: Returns the element identified by `$self` from whatever file it lives in. So if you're looking for `` but don't know if it's in a spread or a story, use this. Throws if it fails but I can't imagine you'd be looking for an element by using an arbitrary self attribute. If you do, wrap this call in a `try/catch` block.
- `addStoryToDesignMap($val)`: If you've created a new story, this is a quick method to add your story to the package and put it in the `designmap.xml` so InDesign can find it. `$val` needs to be a `DOMDocument`.
- `getAppliedStyle($node)`: given a `CharacterStyleRange` or `ParagraphStyleRange` element, this method will return the associated `CharacterStyle` or `ParagraphStyle` node from the `Styles.xml` file.
- `getStyleAttribute($node, $attr)`: given a `CharacterStyleRange` or `ParagraphStyleRange` node and the name of an attribute, this method will return the value of that attribute as thoroughly as possible by checking the node, its applied style node, and its parent and parent's applied style nodes (if applicable).
- `getStyleProperty($node, $prop)`: the same as `getStyleAttribute()` but for properties rather than attributes.
- `getMarkupTag($node)`: Get the tag associated with a given element (`DOMNode`) - or an ancestor. It searches every element from `$node` up and returns the first tag it finds. This logic may not exactly jibe with how tags are intended to work in IDML; it does what I need it to do for my project but may not work for you. The tag it returns is `urldecode()`ed.
- `saveAll($zip_file_path)`: Save all the files in the IDML. There are individual save methods for saving various pieces but why bother? Just use this one.

Everything else you'll just have to figure out on your own.

#### License

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/970e9207938e33441b0b7e3207c46b4df8ed7f020c77e40793812405ae8b0a3b?d=identicon)[Prometee](/maintainers/Prometee)

---

Top Contributors

[![deathlyfrantic](https://avatars.githubusercontent.com/u/7629614?v=4)](https://github.com/deathlyfrantic "deathlyfrantic (6 commits)")[![Prometee](https://avatars.githubusercontent.com/u/861820?v=4)](https://github.com/Prometee "Prometee (2 commits)")[![noam148](https://avatars.githubusercontent.com/u/10885039?v=4)](https://github.com/noam148 "noam148 (1 commits)")

### Embed Badge

![Health badge](/badges/prometee-php-idml/health.svg)

```
[![Health](https://phpackages.com/badges/prometee-php-idml/health.svg)](https://phpackages.com/packages/prometee-php-idml)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
