Download the PHP package ephpoffice/phpword without Composer

On this page you can find all versions of the php package ephpoffice/phpword. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpword

PHPWord

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

OpenXML - Read, Write and Create Word documents in PHP.

PHPWord is a library written in PHP that create word documents.

No Windows operating system is needed for usage because the result are docx files (Office Open XML) that can be opened by all major office software.

Want to contribute? Fork us!

Requirements

Installation

It is recommended that you install the PHPWord library through composer. To do so, add the following lines to your composer.json.

Documentation

Table of contents

  1. Basic usage
    • Measurement units
  2. Sections
    • Section settings
    • Section page numbering
  3. Texts
    • Attributes
  4. Paragraph Style
    • Attributes
  5. Tables
    • Cell Style
  6. Images
    • Attributes

Basic usage

The following is a basic example of the PHPWord library.

Measurement units

The base length unit in Open Office XML is twip. Twip means "TWentieth of an Inch Point", i.e. 1 twip = 1/1440 inch.

You can use PHPWord helper functions to convert inches, centimeters, or points to twips.

Sections

Every visible element in word is placed inside of a section. To create a section, use the following code:

The $sectionSettings is an optional associative array that sets the section. Example:

Section settings

Below are the available settings for section:

The following two settings are automatically set by the use of the orientation setting. You can alter them but that's not recommended.

Section page numbering

You can change a section page numbering.

Texts

Text can be added by using addText and createTextRun method. addText is used for creating simple paragraphs that only contain texts with the same style. createTextRun is used for creating complex paragraphs that contain text with different style (some bold, other italics, etc) or other elements, e.g. images or links.

addText sample:

createTextRun sample:

Attributes

Paragraph Style

Attributes

Tables

The following illustrates how to create a table.

Cell Style
Cell Span

You can span a cell on multiple columms.

Images

You can add images easily using the following example.

Attributes

To add an image with attributes, consider the following example.


All versions of phpword with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
ext-xml Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ephpoffice/phpword contains the following files

Loading the files please wait ....