PHPWord/docs/setup.rst

65 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2014-03-15 10:00:09 +01:00
.. _setup:
2014-04-26 14:21:52 +07:00
Installing/configuring
======================
2014-03-19 23:08:44 +07:00
Requirements
------------
Mandatory:
- PHP 5.3+
- PHP `Zip <http://php.net/manual/en/book.zip.php>`__ extension
- PHP `XML
Parser <http://www.php.net/manual/en/xml.installation.php>`__
extension
2014-03-19 23:08:44 +07:00
Optional PHP extensions:
- `GD <http://php.net/manual/en/book.image.php>`__
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__
- `XSL <http://php.net/manual/en/book.xsl.php>`__
2014-03-19 23:08:44 +07:00
2014-03-15 10:00:09 +01:00
Installation
2014-03-19 23:08:44 +07:00
------------
There are two ways to install PHPWord, i.e. via
`Composer <http://getcomposer.org/>`__ or manually by downloading the
library.
2014-03-19 23:08:44 +07:00
Using Composer
~~~~~~~~~~~~~~
2014-03-15 10:00:09 +01:00
2014-03-19 23:08:44 +07:00
To install via Composer, add the following lines to your
``composer.json``:
2014-03-21 10:07:17 +01:00
.. code-block:: json
2014-03-15 10:00:09 +01:00
{
"require": {
"phpoffice/phpword": "dev-master"
}
}
Manual install
~~~~~~~~~~~~~~
2014-03-19 23:08:44 +07:00
To install manually, `download PHPWord package from
github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
Extract the package and put the contents to your machine. To use the
library, include ``src/PhpWord/Autoloader.php`` in your script and
invoke ``Autoloader::register``.
2014-03-19 23:08:44 +07:00
2014-03-21 10:07:17 +01:00
.. code-block:: php
2014-03-19 23:08:44 +07:00
require_once '/path/to/src/PhpWord/Autoloader.php';
2014-04-08 21:16:27 +04:00
\PhpOffice\PhpWord\Autoloader::register();
2014-03-19 23:08:44 +07:00
Using samples
-------------
After installation, you can browse and use the samples that we've
2014-03-19 23:08:44 +07:00
provided, either by command line or using browser. If you can access
your PHPWord library folder using browser, point your browser to the
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.