{"id":37008983,"url":"https://github.com/xorcare/php-idml","last_synced_at":"2026-01-14T00:51:12.528Z","repository":{"id":56990841,"uuid":"122847194","full_name":"xorcare/php-idml","owner":"xorcare","description":"A simple class to handle file management of Adobe InDesign IDML files.","archived":true,"fork":true,"pushed_at":"2018-02-25T19:31:09.000Z","size":51,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-02T07:58:14.925Z","etag":null,"topics":["idml","indesign","php","php-idml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"deathlyfrantic/php-idml","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xorcare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-25T15:11:53.000Z","updated_at":"2023-12-08T10:06:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xorcare/php-idml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xorcare/php-idml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fphp-idml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fphp-idml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fphp-idml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fphp-idml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xorcare","download_url":"https://codeload.github.com/xorcare/php-idml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xorcare%2Fphp-idml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["idml","indesign","php","php-idml"],"created_at":"2026-01-14T00:51:12.456Z","updated_at":"2026-01-14T00:51:12.514Z","avatar_url":"https://github.com/xorcare.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-idml\n\nA simple class to handle file management of Adobe InDesign IDML files. Keeping track of all the individual files within\nan `.idml` package is a chore. This helps a bit. (A *bit*.)\n\n[![Packagist indesign/php-idml](https://img.shields.io/badge/packagist-indesign%2Fphp--idml-green.svg?longCache=true\u0026style=for-the-badge)](https://packagist.org/packages/indesign/php-idml)\n\n## Installation\n\n    composer require indesign/php-idml\n\n### Usage\n\nInstantiate the object:\n\n    require __DIR__.'/../vendor/autoload.php';\n    $idml = new \\IDML\\Package();\n    $idml-\u003esetZip(\"filename.idml\")\n    $idml-\u003eload();\n\nThis will unzip `filename.idml` to a directory called `.filename.idml`. This directory will be deleted when the object\nis garbage-collected (see the `__destruct()` method). Alternatively, if you keep your IDMLs stored unzipped, a directory\ncan also be passed to the constructor:\n\n    require __DIR__.'/../vendor/autoload.php';\n    $idml = new \\IDML\\Package();\n    $idml-\u003esetDirectory(\"/path/to/idml/\");\n    $idml-\u003eload();\n\nThis directory will not be deleted upon object destruction. (Admittedly this is not a typical use-case but happened to\nbe how the project I was working on stored things.)\n\nThe `IDML\\Package` object is essentially a file manager/server of `DOMDocument` objects for all the internal files.\nThat's most of what this class does.\n\n    $spreads = $idml-\u003egetSpreads();\n    $storyu12a = $idml-\u003egetStorie(\"u12a\");\n    $backingStory = $idml-\u003egetBackingStory();\n    // etc\n\nGenerally if you want Whatever, use `getWhatever()`. You likely won't need to use any of the setters but they're there\nif you want to do something weird. Note `getSpread()` is a convenience method that gets the first spread, operating\nunder the assumption that there is only one. This applied to the project from which this class was born, but may not\napply to yours. This method is also used in the `addElementToSpread()` method if a spread is not explicitly provided.\nUse caution.\n\n### Notable Methods\n\nThese are just the most generic methods that existed in the project-specific version of this class. I have put zero\neffort into trying to make this a generically useful class.\n\n- `getLayers($selfsOnly, $visibleOnly)`: Returns an array of layers from the `designmap.xml` of this IDML. It can either\n  return the layer elements (`DOMNodes`) or the self attributes (e.g. \"u12a\") of the layers. The `$visibleOnly` flag\n  determines whether non-visible layers should be included.\n- `getElementBySelfAttribute($self)`: Returns the element identified by `$self` from whatever file it lives in. So if\n  you're looking for `\u003cRectangle Self=\"u12a\"\u003e` but don't know if it's in a spread or a story, use this. Throws if\n  it fails but I can't imagine you'd be looking for an element by using an arbitrary self attribute. If you do, wrap\n  this call in a `try/catch` block.\n- `addStoryToDesignMap($val)`: If you've created a new story, this is a quick method to add your story to the package\n  and put it in the `designmap.xml` so InDesign can find it. `$val` needs to be a `DOMDocument`.\n- `getAppliedStyle($node)`: given a `CharacterStyleRange` or `ParagraphStyleRange` element, this method will return the\n  associated `CharacterStyle` or `ParagraphStyle` node from the `Styles.xml` file.\n- `getStyleAttribute($node, $attr)`: given a `CharacterStyleRange` or `ParagraphStyleRange` node and the name of an\n  attribute, this method will return the value of that attribute as thoroughly as possible by checking the node, its\n  applied style node, and its parent and parent's applied style nodes (if applicable).\n- `getStyleProperty($node, $prop)`: the same as `getStyleAttribute()` but for properties rather than attributes.\n- `getMarkupTag($node)`: Get the tag associated with a given element (`DOMNode`) - or an ancestor. It searches every\n  element from `$node` up and returns the first tag it finds. This logic may not exactly jibe with how tags are intended\n  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\n  `urldecode()`ed.\n- `saveAll($zip_file_path)`: Save all the files in the IDML. There are individual save methods for saving various pieces but why\n  bother? Just use this one.\n\nEverything else you'll just have to figure out on your own.\n\n### License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorcare%2Fphp-idml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxorcare%2Fphp-idml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxorcare%2Fphp-idml/lists"}