{"id":31647842,"url":"https://github.com/alexhaxe/haxe-phpoffice","last_synced_at":"2026-02-14T20:34:12.746Z","repository":{"id":79666966,"uuid":"176097815","full_name":"AlexHaxe/haxe-phpoffice","owner":"AlexHaxe","description":"Haxe externs for PHPOffice libraries","archived":false,"fork":false,"pushed_at":"2023-05-15T00:02:50.000Z","size":61,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-13T03:41:57.857Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexHaxe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-03-17T12:27:23.000Z","updated_at":"2023-05-20T01:25:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"fccc3db5-ed04-4959-984c-5ca01c853645","html_url":"https://github.com/AlexHaxe/haxe-phpoffice","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/AlexHaxe/haxe-phpoffice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHaxe%2Fhaxe-phpoffice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHaxe%2Fhaxe-phpoffice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHaxe%2Fhaxe-phpoffice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHaxe%2Fhaxe-phpoffice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexHaxe","download_url":"https://codeload.github.com/AlexHaxe/haxe-phpoffice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHaxe%2Fhaxe-phpoffice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29455355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"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":[],"created_at":"2025-10-07T06:46:09.767Z","updated_at":"2026-02-14T20:34:12.741Z","avatar_url":"https://github.com/AlexHaxe.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Haxe externs for PHPOffice\n\nVery incomplete collection of Haxe externs for [PHPWord](https://github.com/PHPOffice/PHPWord) and [PhpSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) libraries from [PHPOffice](https://github.com/PHPOffice)\n\nI have only implemented enough externs to make it work in one of my projects, if you find an api call or a type missing, please create an issue or open a pull request. Thanks!\n\n## Usage\n\n- First you need an installation of PHPOffice libraries so either PhpSpreadsheet or PHPWord (or both). You might also need parts of [Common](https://github.com/PHPOffice/Common) and maybe [SimpleCache](https://github.com/php-fig/simple-cache)\n- You need haxe-phpoffice library so run `haxelib install phpoffice`\n- I didn't install those libraries through Composer (suggested in PHPOffice's documentation), but rather obtained all sources from git.\n- I placed all sources into one folder called `externalLibs`, building a folder structure so that folders reflect namespaces, e.g. `externalLibs/PHPOffice/PhpSpreadsheet/Spreadsheet.php`\n- And then I added `externalLibs` to my include path, I did this by editing `index.php` (the entrypoint that Haxe generates from your code) and changing\n`set_include_path(get_include_path().PATH_SEPARATOR.__DIR__.'/lib');` to `set_include_path(get_include_path().PATH_SEPARATOR.__DIR__.'/lib'.PATH_SEPARATOR.__DIR__.'/externalLibs');`. You can probably use other ways to add these external libs to your include path.\n- I have commented out `-main MainClass` from my build.hxml so Haxe won't overwrite `index.php` on every compile (`index.php` usually doesn't change)\n- Add `-lib phpoffice` to your build files\n- Start using externs\n\n## Sample\n\n```haxe\nimport php.Lib;\nimport php.phpoffice.phpspreadsheet.Spreadsheet;\nimport php.phpoffice.phpspreadsheet.worksheet.Worksheet;\nimport php.phpoffice.phpspreadsheet.writer.Xlsx;\n\nclass Main {\n  public static function main() {\n    var spreadsheet:Spreadsheet = new Spreadsheet();\n    spreadsheet.getProperties()\n      .setCreator(\"Me\")\n      .setLastModifiedBy(\"Me\")\n      .setTitle(\"TestSpreadsheet\")\n      .setSubject(\"TestSpreadsheet\")\n      .setCategory(\"Test\");\n\n    var worksheet:Worksheet = spreadsheet.getActiveSheet();\n    worksheet.getPageSetup ()\n      .setPaperSize (A4)\n      .setOrientation (LANDSCAPE)\n      .setHorizontalCentered (true)\n      .setVerticalCentered (true)\n      .setFitToPage (true);\n    worksheet.getPageMargins ()\n      .setBottom (0.4)\n      .setTop (0.4)\n      .setLeft (0.4)\n      .setRight (0.4);\n\n    worksheet.setTitle(\"Tab-Title\");\n    worksheet.getColumnDimension(\"A\").setAutoSize(true);\n    worksheet.getColumnDimension(\"B\").setAutoSize(true);\n    worksheet.mergeCells(\"A1:F1\");\n    worksheet.mergeCells(\"A2:F2\");\n\n    worksheet.setCellValue(\"A1\", \"Headline\");\n    worksheet.setCellValue(\"A2\", \"Subtitle\");\n    worksheet.getStyle(\"A1\").applyFromArray(Lib.associativeArrayOfHash([\n      \"font\" =\u003e Lib.associativeArrayOfHash([\"bold\" =\u003e true]),\n      \"fill\" =\u003e Lib.associativeArrayOfHash([\n        \"fillType\" =\u003e \"solid\",\n        \"color\" =\u003e Lib.associativeArrayOfHash([\"argb\" =\u003e \"FFD9D9D9\"])\n      ]),\n      \"borders\" =\u003e Lib.associativeArrayOfHash([\"allBorders\" =\u003e Lib.associativeArrayOfHash([\"borderStyle\" =\u003e \"thin\"])]),\n      \"alignment\" =\u003e Lib.associativeArrayOfHash([\"horizontal\" =\u003e \"center\", \"vertical\" =\u003e \"bottom\", \"wrapText\" =\u003e false]),\n    ]));\n\n    var writer:Xlsx = new Xlsx(spreadsheet);\n    writer.save(\"/tmp/myFirstSpreadsheet.xlsx\");\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhaxe%2Fhaxe-phpoffice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexhaxe%2Fhaxe-phpoffice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhaxe%2Fhaxe-phpoffice/lists"}