{"id":37261903,"url":"https://github.com/wpkg/wpkg-php","last_synced_at":"2026-01-15T23:13:23.436Z","repository":{"id":57082242,"uuid":"105210734","full_name":"wpkg/wpkg-php","owner":"wpkg","description":"WPKG XML configuration generator, created in PHP language","archived":false,"fork":false,"pushed_at":"2018-03-07T12:33:07.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T18:19:34.704Z","etag":null,"topics":["generator","wpkg","xml"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpkg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-29T00:07:27.000Z","updated_at":"2017-10-15T10:56:08.000Z","dependencies_parsed_at":"2022-08-24T14:58:19.659Z","dependency_job_id":null,"html_url":"https://github.com/wpkg/wpkg-php","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/wpkg/wpkg-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpkg%2Fwpkg-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpkg%2Fwpkg-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpkg%2Fwpkg-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpkg%2Fwpkg-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpkg","download_url":"https://codeload.github.com/wpkg/wpkg-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpkg%2Fwpkg-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["generator","wpkg","xml"],"created_at":"2026-01-15T23:13:22.660Z","updated_at":"2026-01-15T23:13:23.431Z","avatar_url":"https://github.com/wpkg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![WPKG Logo](https://wpkg.org/wpkg.png)\n\n# WPKG XML configuration generator\n\nLibrary written on PHP7 for generating XML files with configuration for WPKG installer.\n\n    composer require drteam/wpkg-php\n\nCheck [links](#some-links) for more info about WPKG.\n\nIf you need Active Directory support for generation `hosts.xml` from domain PCs you can\nlook at [WPKG-AD project](https://github.com/wpkg/wpkg-php-ad), which based on this library. \n\n# Table of Contents\n\n- [How to create XML](#how-to-create-xml)\n    - [Config](#config)\n        - [Config.xml file](#configxml-file)\n        - [Note about translations](#note-about-translations)\n    - [Hosts](#hosts)\n        - [Single host](#single-host)\n        - [Hosts.xml file](#hostsxml-file)\n        - [Computers from Active Directory](#computers-from-active-directory)\n    - [Profiles](#profiles)\n        - [Single profile](#single-profile)\n        - [Profiles.xml file](#profilesxml-file)\n    - [Packages](#packages)\n        - [Single package](#single-package)\n        - [Packages.xml file](#packagesxml-file)\n- [How to import existed XML](#how-to-import-existed-xml)\n    - [Import Config.xml file](#import-configxml-file)\n- [Get Support](#get-support)\n- [Some links](#some-links)\n\n# How to create XML\n\nSome examples with descriptions you can find [here](extra).\n\n## Config\n\nConfiguration settings for runtime behavior of *wpkg.js*\n\n### *Config.xml* file\n\nUsing the Config class, you can override the settings, if you specified\na value different from the default value, your parameter will be added\nto the XML file.\n\nIf you do not specify anything, a configuration with default parameters\nwill be generated.\n\n```php\n$_config = new \\WPKG\\Config();\n\n// Overwrite some attributes\n$_config\n    -\u003ewith('wpkg_base', 'http://example.com')\n    -\u003ewith('quitonerror', true)\n    -\u003ewith('debug', true);\n\n// Now we can set the variables\n$_config\n    -\u003ewithVariable('PROG_FILES32', \"%ProgramFiles%\", null, \"x86\")\n    -\u003ewithVariable('PROG_FILES32', \"%ProgramFiles(x86)%\", null, \"x64\")\n    -\u003ewithVariable('DESKTOP', \"%ALLUSERSPROFILE%\\Desktop\", \"Windows xp\")\n    -\u003ewithVariable('DESKTOP', \"%PUBLIC%\\Desktop\", \"Windows 7\");\n\n\n// Show current variant of generated XML\necho $_config-\u003eshow();\n```\n\nResult of execution:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cconfig xmlns:profiles=\"http://www.wpkg.org/config\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/config xsd/config.xsd\"\u003e\n  \u003clanguages\u003e\n    ... a lot of lines with translations ...\n  \u003c/languages\u003e\n  \u003cparam name=\"wpkg_base\" value=\"http://example.com\"/\u003e\n  \u003cparam name=\"quitonerror\" value=\"true\"/\u003e\n  \u003cparam name=\"debug\" value=\"true\"/\u003e\n  \u003cvariables\u003e\n    \u003cvariable name=\"PROG_FILES32\" value=\"%ProgramFiles%\" architecture=\"x86\"/\u003e\n    \u003cvariable name=\"PROG_FILES32\" value=\"%ProgramFiles(x86)%\" architecture=\"x64\"/\u003e\n    \u003cvariable name=\"DESKTOP\" value=\"%ALLUSERSPROFILE%\\Desktop\" os=\"Windows xp\"/\u003e\n    \u003cvariable name=\"DESKTOP\" value=\"%PUBLIC%\\Desktop\" os=\"Windows 7\"/\u003e\n  \u003c/variables\u003e\n\u003c/config\u003e\n```\n\n### Note about translations\n\nAt the moment, translations (creators of the WPKG project call them languages) are available for the following languages:\n\n* English\n* French\n* German\n* Italian\n* Russian (added by me)\n* Spanish\n\nTranslations was taken from the *config.xml* file that was in the [wpkg-1.3.1-bin.zip](http://wpkg.org/files/stable/1.3.x/wpkg-1.3.1-bin.zip)\narchive from the official website of the [WPKG project](https://wpkg.org/Download).\n\nAll available translations of *wpkg-php* you can find [here](src/Languages).\n\nIf you do not see your language on the list and want to help the project, then you\ncan suggest your translation variant via [issues](https://github.com/DrTeamRocks/wpkg-php/issues) or **PR**.\nPay attention to LCID, these are unique language identifiers, a complete list\nof them you can find [here](http://www.microsoft.com/globaldev/reference/lcid-all.mspx).\n\n## Hosts\n\nMappings between machine names and profile names.\n\n### Single host\n\nIf you want generate few hosts in separated files:\n\n```php\n// Root container\n$_host = new \\WPKG\\Host();\n\n// Need to add some parameters\n$_host\n    -\u003ewith('name', 'host1')\n    -\u003ewith('profile-id', 'profile1');\n\necho $_host-\u003eshow();\n```\n\nResult is:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003chosts:wpkg xmlns:hosts=\"http://www.wpkg.org/hosts\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/hosts xsd/hosts.xsd\"\u003e\n  \u003chost name=\"host1\" profile-id=\"profile1\"/\u003e\n\u003c/hosts:wpkg\u003e\n```\n\nYou also can set array of profiles:\n\n```php\n// Root container\n$_host = new \\WPKG\\Host();\n\n// Need to add some parameters\n$_host\n    -\u003ewith('name', 'host1')\n    -\u003ewith('profile-id', ['profile1', 'profile2', 'profile3']);\n\necho $_host-\u003eshow();\n```\n\nAnd in result must be:\n\n```xml\n\u003chosts:wpkg xmlns:hosts=\"http://www.wpkg.org/hosts\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/hosts xsd/hosts.xsd\"\u003e\n  \u003chost name=\"host1\" profile-id=\"profile1\"\u003e\n    \u003cprofile profile-id=\"profile2\"/\u003e\n    \u003cprofile profile-id=\"profile3\"/\u003e\n  \u003c/host\u003e\n\u003c/hosts:wpkg\u003e\n```\n\n### Hosts.xml file\n\nIf you need one large file with all your hosts:\n\n```php\n// Root container\n$_hosts = new Hosts();\n\n/**\n * Test host #1\n */\n$host1 = new Host();\n$host1\n    -\u003ewith('name', 'host1')\n    -\u003ewith('profile-id', 'profile1');\n\n$_hosts-\u003esetHost($host1);\n\n/**\n * Test host #2\n */\n$host2 = new Host();\n$host2\n    -\u003ewith('name', 'host2')\n    -\u003ewith('profile-id', ['profile1', 'profile2', 'profile3']);\n\n$_hosts-\u003esetHost($host2);\n\n/**\n * Test host #3\n */\n$host3 = new Host();\n$host3\n    -\u003ewith('name', 'host3')\n    -\u003ewith('profile-id', 'profile3');\n\n$_hosts-\u003esetHost($host3);\n\necho $_hosts-\u003eshow();\n```\n\nResult file *hosts.xml* into the **wpkg_path** folder\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003chosts:wpkg xmlns:hosts=\"http://www.wpkg.org/hosts\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/hosts xsd/hosts.xsd\"\u003e\n  \u003chost name=\"host1\" profile-id=\"profile1\"/\u003e\n  \u003chost name=\"host2\" profile-id=\"profile1\"\u003e\n    \u003cprofile profile-id=\"profile2\"/\u003e\n    \u003cprofile profile-id=\"profile3\"/\u003e\n  \u003c/host\u003e\n  \u003chost name=\"host3\" profile-id=\"profile3\"/\u003e\n\u003c/hosts:wpkg\u003e\n```\n\n### Computers from Active Directory\n\nThis class based on [adLdap library](https://github.com/adldap/adLDAP),\nso you can use any configuration parameters from this library.\n\nBasic usage:\n\n```php\nuse \\WPKG\\Drivers\\ADImport;\n\n// Read AD configuration\n$_config = include __DIR__ . '/adldap.php';\n\n// Set Import object for work and put configuration inside\n$_import = new ADImport($_config);\n\n// You also can set config via specific method\n//$_import-\u003esetConfig($_config);\n\n// Choose work mode (only hosts available) and output the XML\n$_hosts = $_import-\u003eimport('hosts');\n$out = $_hosts-\u003eshow();\n\nprint_r($out);\n```\n\nYou should saw something like this:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003chosts:wpkg xmlns:hosts=\"http://www.wpkg.org/hosts\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/hosts xsd/hosts.xsd\"\u003e\n  \u003chost name=\"user1.example.com\" profile-id=\"default\"/\u003e\n  \u003chost name=\"user2.example.com\" profile-id=\"default\"/\u003e\n  \u003chost name=\"user3.example.com\" profile-id=\"default\"/\u003e\n\u003c/hosts:wpkg\u003e\n```\n\n## Profiles\n\nSpecifies which packages will be installed/executed for each WPKG profile.\n\n### Single profile\n\nIf you want generate few profiles in separated files:\n\n```php\nuse WPKG\\Profile;\n\n$_profile = new \\WPKG\\Profile();\n\n$_profile\n    -\u003ewith('id', 'profile1')\n    -\u003ewith('packages', 'DotNet')\n    -\u003ewith('depends', 'profile2');\n\n// Show current variant of generated config\necho $_profile-\u003eshow();\n```\n\nResult file (with name like \u003cid\u003e.xml, eg profile1.xml like in current example) you can find into the **wpkg_path**/profiles/ subfolder:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cprofiles:profiles xmlns:profiles=\"http://www.wpkg.org/profiles\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/profiles xsd/profiles.xsd\"\u003e\n  \u003cprofile id=\"profile1\"\u003e\n    \u003cdepends profile-id=\"profile2\"/\u003e\n    \u003cpackage package-id=\"DotNet\"/\u003e\n  \u003c/profile\u003e\n\u003c/profiles:profiles\u003e\n```\n\nYou as in hosts also can set array of `packages` or `depends`.\n\n### Profiles.xml file\n\nIf you need one large file with all your profiles:\n\n```php\n$_profiles = new \\WPKG\\Profiles();\n\n/**\n * Test profile #1\n */\n$pr1 = new Profile();\n$pr1-\u003ewith('id', 'profile1');\n\n$_profiles-\u003esetProfile($pr1);\n\n/**\n * Test profile #2\n */\n$pr2 = new Profile();\n$pr2-\u003ewith('id', 'profile2')\n    -\u003ewith('packages', 'DotNet');\n\n$_profiles-\u003esetProfile($pr2);\n\n/**\n * Test profile #3\n */\n$pr3 = new Profile();\n$pr3-\u003ewith('id', 'profile3')\n    -\u003ewith('packages', ['Firefox', 'Chromium', 'Opera'])\n    -\u003ewith('depends', 'profile1');\n\n$_profiles-\u003esetProfile($pr3);\n\n/**\n * Test profile #4\n */\n$pr4 = new Profile();\n$pr4-\u003ewith('id', 'profile4')\n    -\u003ewith('packages', ['SuperBank', 'AnotherBank'])\n    -\u003ewith('depends', ['profile1', 'profile2']);\n\n$_profiles-\u003esetProfile($pr4);\n\n/**\n * Test profile #5\n */\n$pr5 = new Profile();\n$pr5-\u003ewith('id', 'profile5')\n    -\u003ewith('depends', 'profile3');\n\n$_profiles-\u003esetProfile($pr5);\n\n// Show current variant of generated config\necho $_profiles-\u003eshow();\n```\n\nResult:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cprofiles:profiles xmlns:profiles=\"http://www.wpkg.org/profiles\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/profiles xsd/profiles.xsd\"\u003e\n  \u003cprofile id=\"profile1\"/\u003e\n  \u003cprofile id=\"profile2\"\u003e\n    \u003cpackage package-id=\"DotNet\"/\u003e\n  \u003c/profile\u003e\n  \u003cprofile id=\"profile3\"\u003e\n    \u003cdepends profile-id=\"profile1\"/\u003e\n    \u003cpackage package-id=\"Firefox\"/\u003e\n    \u003cpackage package-id=\"Chromium\"/\u003e\n    \u003cpackage package-id=\"Opera\"/\u003e\n  \u003c/profile\u003e\n  \u003cprofile id=\"profile4\"\u003e\n    \u003cdepends profile-id=\"profile1\"/\u003e\n    \u003cdepends profile-id=\"profile2\"/\u003e\n    \u003cpackage package-id=\"SuperBank\"/\u003e\n    \u003cpackage package-id=\"AnotherBank\"/\u003e\n  \u003c/profile\u003e\n  \u003cprofile id=\"profile5\"\u003e\n    \u003cdepends profile-id=\"profile3\"/\u003e\n  \u003c/profile\u003e\n\u003c/profiles:profiles\u003e\n```\n\n## Packages\n\nDefines software packages (commands for WPKG to install/uninstall programs, etc.)\n\n### Single package\n\nIf you want generate few packages in separated files:\n\n```php\nuse \\WPKG\\Package;\nuse \\WPKG\\PackageCheckExits;\n\n$_package = new Package();\n$_exits = new PackageCheckExits();\n\n// Overwrite the attributes of tha class\n$_package\n    -\u003ewith('id', 'wpkg1')\n    -\u003ewith('name', 'Windows Packager sample 1')\n    -\u003ewith('revision', 1)\n    -\u003ewith('priority', 0)\n    -\u003ewith('reboot', 'false');\n\n// Small check for Windows 7\n$_package\n    -\u003ewithCheck('registry', 'exists', 'HKLM\\Software\\wpkg\\full\\key\\not\\part\\of\\it')\n    -\u003ewithCheck('file', 'exists', 'C:\\wpkg\\wpkg.bat')\n    -\u003ewithCheck('uninstall', 'exists', 'WPKG 0.6-test1');\n\n// Add few variables to package config\n$_package\n    -\u003ewithVariable('PROG_FILES32', \"%ProgramFiles(x86)%\", null, \"x64\")\n    -\u003ewithVariable('DESKTOP', \"%ALLUSERSPROFILE%\\Desktop\", \"Windows xp\");\n\n// We need set exit codes for some installation stages\n$_exits\n    -\u003eadd(0)\n    -\u003eadd(3010, true)\n    -\u003eadd('any')\n    -\u003eadd(2);\n\n// Run command\n$_package\n    -\u003ewithCommand('install', 'msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"', 'test', $_exits)\n    -\u003ewithCommand('remove', 'msiexec /x /qn \"%SOFTWARE%\\path\\to\\msi\"')\n    -\u003ewithCommand('upgrade', 'msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"')\n    -\u003ewithCommand('downgrade', null, 'remove')\n    -\u003ewithCommand('downgrade', null, 'install');\n\necho $_package-\u003eshow();\n```\n\nResult:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cpackages:packages xmlns:packages=\"http://www.wpkg.org/packages\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/packages xsd/packages.xsd\"\u003e\n  \u003cpackage id=\"wpkg1\" name=\"Windows Packager sample 1\" revision=\"1\" priority=\"0\" reboot=\"false\"\u003e\n    \u003ccheck type=\"registry\" condition=\"exists\" path=\"HKLM\\Software\\wpkg\\full\\key\\not\\part\\of\\it\"/\u003e\n    \u003ccheck type=\"file\" condition=\"exists\" path=\"C:\\wpkg\\wpkg.bat\"/\u003e\n    \u003ccheck type=\"uninstall\" condition=\"exists\" path=\"WPKG 0.6-test1\"/\u003e\n    \u003cvariable name=\"PROG_FILES32\" value=\"%ProgramFiles(x86)%\" architecture=\"x64\"/\u003e\n    \u003cvariable name=\"DESKTOP\" value=\"%ALLUSERSPROFILE%\\Desktop\" os=\"Windows xp\"/\u003e\n    \u003ccommands\u003e\n      \u003ccommand type=\"install\" cmd='msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"' include=\"test\"\u003e\n        \u003cexit code=\"0\"/\u003e\n        \u003cexit code=\"3010\" reboot=\"true\"/\u003e\n        \u003cexit code=\"any\"/\u003e\n        \u003cexit code=\"2\"/\u003e\n      \u003c/command\u003e\n      \u003ccommand type=\"remove\" cmd='msiexec /x /qn \"%SOFTWARE%\\path\\to\\msi\"'/\u003e\n      \u003ccommand type=\"upgrade\" cmd='msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"'/\u003e\n      \u003ccommand type=\"downgrade\" include=\"remove\"/\u003e\n      \u003ccommand type=\"downgrade\" include=\"install\"/\u003e\n    \u003c/commands\u003e\n  \u003c/package\u003e\n\u003c/packages:packages\u003e\n```\n\n### Packages.xml file\n\nIf you need one large file with all your packages:\n\n```php\nuse \\WPKG\\Package;\nuse \\WPKG\\PackageCheckExits;\nuse \\WPKG\\Packages;\n\n// Root container\n$_packages = new Packages();\n\n/**\n * Test package #1\n */\n$pk1 = new Package();\n$pk1-\u003ewith('id', 'time')\n    -\u003ewith('name', 'Time Synchronization')\n    -\u003ewith('priority', 100)\n    -\u003ewith('execute', 'always')\n    -\u003ewithCheck('host', 'os', 'windows 7')\n    -\u003ewithCommand('install', 'net time \\\\timeserver /set /yes');\n\n$_packages-\u003esetPackage($pk1);\n\n/**\n * Test package #2\n */\n$pk2 = new Package();\n$pk2_exits = new PackageCheckExits();\n\n// We need set exit codes for some installation stages\n$pk2_exits\n    -\u003eadd(0)\n    -\u003eadd(3010, true)\n    -\u003eadd('any')\n    -\u003eadd(2);\n\n$pk2-\u003ewith('id', 'wpkg')\n    -\u003ewith('name', 'Windows Packager sample 1')\n    -\u003ewith('revision', 1)\n    -\u003ewith('priority', 0)\n    -\u003ewith('reboot', 'false')\n    -\u003ewithCheck('registry', 'exists', 'HKLM\\Software\\wpkg\\full\\key\\not\\part\\of\\it')\n    -\u003ewithCheck('file', 'exists', 'C:\\wpkg\\wpkg.bat')\n    -\u003ewithCheck('uninstall', 'exists', 'WPKG 0.6-test1')\n    -\u003ewithCommand('install', 'msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"', 'test', $pk2_exits)\n    -\u003ewithCommand('remove', 'msiexec /x /qn \"%SOFTWARE%\\path\\to\\msi\"')\n    -\u003ewithCommand('upgrade', 'msiexec /i /qn \"%SOFTWARE%\\path\\to\\msi\"')\n    -\u003ewithCommand('downgrade', null, 'remove')\n    -\u003ewithCommand('downgrade', null, 'install');\n\n$_packages-\u003esetPackage($pk2);\n\n/**\n * Test package #3\n */\n$pk3 = new Package();\n$pk3-\u003ewith('id', 'time3')\n    -\u003ewith('name', 'Time Synchronization')\n    -\u003ewith('priority', 100)\n    -\u003ewith('execute', 'always')\n    -\u003ewithCheck('host', 'os', 'windows 7')\n    -\u003ewithCommand('install', 'net time \\\\timeserver /set /yes');\n\n$_packages-\u003esetPackage($pk3);\n\necho $_packages-\u003eshow();\n```\n\nResult:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cpackages:packages xmlns:packages=\"http://www.wpkg.org/packages\" xmlns:wpkg=\"http://www.wpkg.org/wpkg\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.wpkg.org/packages xsd/packages.xsd\"\u003e\n  \u003cpackage id=\"time\" name=\"Time Synchronization\" priority=\"100\" execute=\"always\"\u003e\n    \u003ccheck type=\"host\" condition=\"os\" path=\"windows 7\"/\u003e\n    \u003ccommands\u003e\n      \u003ccommand type=\"install\" cmd=\"net time \\timeserver /set /yes\"/\u003e\n    \u003c/commands\u003e\n  \u003c/package\u003e\n  \u003cpackage id=\"wpkg\" name=\"Windows Packager sample 1\" revision=\"1\" priority=\"0\" reboot=\"false\"\u003e\n    \u003ccheck type=\"registry\" condition=\"exists\" path=\"HKLM\\Software\\wpkg\\full\\key\\not\\part\\of\\it\"/\u003e\n    \u003ccheck type=\"file\" condition=\"exists\" path=\"C:\\wpkg\\wpkg.bat\"/\u003e\n    \u003ccheck type=\"uninstall\" condition=\"exists\" path=\"WPKG 0.6-test1\"/\u003e\n    \u003ccommands\u003e\n      \u003ccommand type=\"install\" cmd=\"msiexec /i /qn \u0026quot;%SOFTWARE%\\path\\to\\msi\u0026quot;\" include=\"test\"\u003e\n        \u003cexit code=\"0\"/\u003e\n        \u003cexit code=\"3010\" reboot=\"true\"/\u003e\n        \u003cexit code=\"any\"/\u003e\n        \u003cexit code=\"2\"/\u003e\n      \u003c/command\u003e\n      \u003ccommand type=\"remove\" cmd=\"msiexec /x /qn \u0026quot;%SOFTWARE%\\path\\to\\msi\u0026quot;\"/\u003e\n      \u003ccommand type=\"upgrade\" cmd=\"msiexec /i /qn \u0026quot;%SOFTWARE%\\path\\to\\msi\u0026quot;\"/\u003e\n      \u003ccommand type=\"downgrade\" include=\"remove\"/\u003e\n      \u003ccommand type=\"downgrade\" include=\"install\"/\u003e\n    \u003c/commands\u003e\n  \u003c/package\u003e\n  \u003cpackage id=\"time3\" name=\"Time Synchronization\" priority=\"100\" execute=\"always\"\u003e\n    \u003ccheck type=\"host\" condition=\"os\" path=\"windows 7\"/\u003e\n    \u003ccommands\u003e\n      \u003ccommand type=\"install\" cmd=\"net time \\timeserver /set /yes\"/\u003e\n    \u003c/commands\u003e\n  \u003c/package\u003e\n\u003c/packages:packages\u003e\n```\n\n# How to import existed XML\n\n## Import Config.xml file\n\nFirst you need enable the importer class\n\n```php\nuse \\WPKG\\Drivers\\XMLImport;\n\n// Create new object\n$_import = new XMLImport();\n\n// Content of hosts file\n$_hosts_file = file_get_contents('config.xml');\n\n// Read and parse file to normal format\n$_hosts = $_import-\u003eimport($_hosts_file);\n\n// Print array to stdOut\nprint_r($_hosts);\n```\n\nNow inside `$_hosts` variable you can find the [\\WPKG\\Hosts](#hostsxml-file) object with all hosts which was imported.\n\nSame operation for all other configurations, library can check which config you are loaded.\n\n# Get Support!\n\n* [Discord](https://discord.gg/vRjVfHK) - Join us on Discord.\n* [GitHub Issues](https://github.com/wpkg/wpkg-php/issues) - Got issues? Please tell us!\n* [Roadmap](https://github.com/wpkg/wpkg-php/wiki) - Want to contribute? Get involved!\n\n# Some links\n\n* Main the WPKG website - https://wpkg.org/\n* WPKG documentation page - https://wpkg.org/Documentation\n* Article on Wikipedia - https://en.wikipedia.org/wiki/WPKG_(software)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpkg%2Fwpkg-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpkg%2Fwpkg-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpkg%2Fwpkg-php/lists"}