{"id":15037382,"url":"https://github.com/phpoffice/phpword","last_synced_at":"2025-09-09T21:06:47.020Z","repository":{"id":3208206,"uuid":"4242230","full_name":"PHPOffice/PHPWord","owner":"PHPOffice","description":"A pure PHP library for reading and writing word processing documents","archived":false,"fork":false,"pushed_at":"2025-02-20T20:25:09.000Z","size":82364,"stargazers_count":7397,"open_issues_count":1162,"forks_count":2720,"subscribers_count":307,"default_branch":"master","last_synced_at":"2025-05-05T16:06:12.983Z","etag":null,"topics":["doc","docx","html","libreoffice-writer","msword","odt","office","pdf","php","rtf"],"latest_commit_sha":null,"homepage":"https://phpoffice.github.io/PHPWord/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPOffice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/support.yml","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-05-06T16:04:30.000Z","updated_at":"2025-05-05T07:22:00.000Z","dependencies_parsed_at":"2023-09-23T11:25:23.096Z","dependency_job_id":"57b25604-f738-44dd-9ae5-1dd96236aac6","html_url":"https://github.com/PHPOffice/PHPWord","commit_stats":{"total_commits":1656,"total_committers":192,"mean_commits":8.625,"dds":0.7644927536231885,"last_synced_commit":"08064480ea915a7283a5a09ba68ad04869cb259e"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPOffice%2FPHPWord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPOffice%2FPHPWord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPOffice%2FPHPWord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPOffice%2FPHPWord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPOffice","download_url":"https://codeload.github.com/PHPOffice/PHPWord/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253818751,"owners_count":21969213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["doc","docx","html","libreoffice-writer","msword","odt","office","pdf","php","rtf"],"created_at":"2024-09-24T20:34:28.892Z","updated_at":"2025-05-12T20:46:04.292Z","avatar_url":"https://github.com/PHPOffice.png","language":"PHP","readme":"# ![PHPWord](https://rawgit.com/PHPOffice/PHPWord/develop/docs/images/phpword.svg \"PHPWord\")\n\n[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v)](https://packagist.org/packages/phpoffice/phpword)\n[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/PHPWord/badge.svg?branch=master)](https://coveralls.io/github/PHPOffice/PHPWord?branch=master)\n[![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads)](https://packagist.org/packages/phpoffice/phpword)\n[![License](https://poser.pugx.org/phpoffice/phpword/license)](https://packagist.org/packages/phpoffice/phpword)\n\nBranch Master : [![PHPWord](https://github.com/PHPOffice/PHPWord/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/PHPOffice/PHPWord/actions/workflows/php.yml)\n\nPHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF.\n\nPHPWord is an open source project licensed under the terms of [LGPL version 3](COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://github.com/PHPOffice/PHPWord/actions) and unit testing. You can learn more about PHPWord by reading the [Developers' Documentation](https://phpoffice.github.io/PHPWord/).\n\nIf you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)\n\nRead more about PHPWord:\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Getting started](#getting-started)\n- [Contributing](#contributing)\n- [Developers' Documentation](https://phpoffice.github.io/PHPWord/)\n\n## Features\n\nWith PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP scripts. Below are some of the things that you can do with PHPWord library:\n\n- Set document properties, e.g. title, subject, and creator.\n- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering\n- Create header and footer for each sections\n- Set default font type, font size, and paragraph style\n- Use UTF-8 and East Asia fonts/characters\n- Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text\n- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements\n- Insert titles (headers) and table of contents\n- Insert text breaks and page breaks\n- Insert and format images, either local, remote, or as page watermarks\n- Insert binary OLE Objects such as Excel or Visio\n- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)\n- Insert list items as bulleted, numbered, or multilevel\n- Insert hyperlinks\n- Insert footnotes and endnotes\n- Insert drawing shapes (arc, curve, line, polyline, rect, oval)\n- Insert charts (pie, doughnut, bar, line, area, scatter, radar)\n- Insert form fields (textinput, checkbox, and dropdown)\n- Create document from templates\n- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template\n- ... and many more features on progress\n\n## Requirements\n\nPHPWord requires the following:\n\n- PHP 7.1+\n- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)\n- [Laminas Escaper component](https://docs.laminas.dev/laminas-escaper/intro/)\n- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)\n- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)\n- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)\n- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )\n- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)\n\n## Installation\n\nPHPWord is installed via [Composer](https://getcomposer.org/).\nTo [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to PHPWord in your project, either\n\nRun the following to use the latest stable version\n```sh\ncomposer require phpoffice/phpword\n```\nor if you want the latest unreleased version\n```sh\ncomposer require phpoffice/phpword:dev-master\n```\n\n## Getting started\n\nThe following is a basic usage example of the PHPWord library.\n\n```php\n\u003c?php\n\n// Creating the new document...\n$phpWord = new \\PhpOffice\\PhpWord\\PhpWord();\n\n/* Note: any element you append to a document must reside inside of a Section. */\n\n// Adding an empty Section to the document...\n$section = $phpWord-\u003eaddSection();\n// Adding Text element to the Section having font styled by default...\n$section-\u003eaddText(\n    '\"Learn from yesterday, live for today, hope for tomorrow. '\n        . 'The important thing is not to stop questioning.\" '\n        . '(Albert Einstein)'\n);\n\n/*\n * Note: it's possible to customize font style of the Text element you add in three ways:\n * - inline;\n * - using named font style (new font style object will be implicitly created);\n * - using explicitly created font style object.\n */\n\n// Adding Text element with font customized inline...\n$section-\u003eaddText(\n    '\"Great achievement is usually born of great sacrifice, '\n        . 'and is never the result of selfishness.\" '\n        . '(Napoleon Hill)',\n    array('name' =\u003e 'Tahoma', 'size' =\u003e 10)\n);\n\n// Adding Text element with font customized using named font style...\n$fontStyleName = 'oneUserDefinedStyle';\n$phpWord-\u003eaddFontStyle(\n    $fontStyleName,\n    array('name' =\u003e 'Tahoma', 'size' =\u003e 10, 'color' =\u003e '1B2232', 'bold' =\u003e true)\n);\n$section-\u003eaddText(\n    '\"The greatest accomplishment is not in never falling, '\n        . 'but in rising again after you fall.\" '\n        . '(Vince Lombardi)',\n    $fontStyleName\n);\n\n// Adding Text element with font customized using explicitly created font style object...\n$fontStyle = new \\PhpOffice\\PhpWord\\Style\\Font();\n$fontStyle-\u003esetBold(true);\n$fontStyle-\u003esetName('Tahoma');\n$fontStyle-\u003esetSize(13);\n$myTextElement = $section-\u003eaddText('\"Believe you can and you\\'re halfway there.\" (Theodor Roosevelt)');\n$myTextElement-\u003esetFontStyle($fontStyle);\n\n// Saving the document as OOXML file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'Word2007');\n$objWriter-\u003esave('helloWorld.docx');\n\n// Saving the document as ODF file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'ODText');\n$objWriter-\u003esave('helloWorld.odt');\n\n// Saving the document as HTML file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'HTML');\n$objWriter-\u003esave('helloWorld.html');\n\n/* Note: we skip RTF, because it's not XML-based and requires a different example. */\n/* Note: we skip PDF, because \"HTML-to-PDF\" approach is used to create PDF documents. */\n```\n\nMore examples are provided in the [samples folder](samples/). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http://localhost:8000](http://localhost:8000) to view the samples.\nYou can also read the [Developers' Documentation](https://phpoffice.github.io/PHPWord/) for more detail.\n\n## Contributing\n\nWe welcome everyone to contribute to PHPWord. Below are some of the things that you can do to contribute.\n\n- Read [our contributing guide](CONTRIBUTING.md).\n- [Fork us](https://github.com/PHPOffice/PHPWord/fork) and [request a pull](https://github.com/PHPOffice/PHPWord/pulls) to the [master](https://github.com/PHPOffice/PHPWord/tree/master) branch.\n- Submit [bug reports or feature requests](https://github.com/PHPOffice/PHPWord/issues) to GitHub.\n- Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpoffice%2Fphpword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpoffice%2Fphpword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpoffice%2Fphpword/lists"}