Find the Exponential Software extensions you want
UNIX name | Owner | Status |
---|---|---|
php-idml | 7x | stable |
Version | Compatible with |
---|---|
N/A | N/A |
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.)
Instantiate the object:
require_once 'IDMLPackage.php';
$idml = new \IDMLPackage\IDMLPackage('filename.idml');
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:
$idml = new \IDMLPackage\IDMLPackage('/path/to/idml/');
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 IDMLPackge 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->getStories('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.
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.
Everything else you'll just have to figure out on your own.
I don't care, do whatever you want. I'm not responsible for anything ever. The end.