Skip to content

Instantly share code, notes, and snippets.

@Rekhyt
Last active February 19, 2019 09:06
Show Gist options
  • Save Rekhyt/2f891f265da85b60d425c26611bd9bba to your computer and use it in GitHub Desktop.
Save Rekhyt/2f891f265da85b60d425c26611bd9bba to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
$fileIn = @$argv[1] ?: '';
$fileOut = @$argv[2] ?: '';
if (empty($fileIn) || empty($fileOut)) die("No files defined.\n\n");
if (!file_exists($fileIn)) die("File {$fileIn} does not exist.\n\n");
$xml = new SimpleXmlElement(file_get_contents($fileIn));
$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
file_put_contents($fileOut, $dom->saveXML());
echo "Done.\n\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment