Skip to content

Commit 8c4efdd

Browse files
author
Gabriel Bull
committed
Added support for composer
1 parent f58524b commit 8c4efdd

File tree

6 files changed

+99
-4
lines changed

6 files changed

+99
-4
lines changed

.gitignore

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
1+
.DS_Store
2+
._*
3+
.Spotlight-V100
4+
.Trashes
5+
Thumbs.db
6+
Desktop.ini
7+
.idea
8+
phpunit.xml
9+
composer.lock
10+
vendor
211
/.settings
312
/.buildpath
413
/.project
5-
/docs
14+
/docs

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
8+
before_script:
9+
- curl -s http://getcomposer.org/installer | php
10+
- php composer.phar install --dev --prefer-source

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,61 @@
11
# PHPWord - OpenXML - Read, Write and Create Word documents in PHP
2+
23
PHPWord is a library written in PHP that create word documents.
3-
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.
4+
No Windows operating system is needed for usage because the result are docx files (Office Open XML) that can be
5+
opened by all major office software.
46

57
## Want to contribute?
68
Fork us!
79

10+
## Requirements
11+
12+
* PHP version 5.2.0 or higher
13+
814
## License
9-
PHPWord is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPWord/blob/master/license.md)
15+
PHPWord is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPWord/blob/master/license.md)
16+
17+
## Installation
18+
19+
It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add
20+
the following lines to your ``composer.json``.
21+
22+
```json
23+
{
24+
"require": {
25+
"phpoffice/phpword": "dev-master"
26+
}
27+
}
28+
```
29+
30+
## Usage
31+
32+
The following is a basic example of the PHPWord library.
33+
34+
```php
35+
// Create a new PHPWord Object
36+
$PHPWord = new PHPWord();
37+
38+
// Every element you want to append to the word document is placed in a section. So you need a section:
39+
$section = $PHPWord->createSection();
40+
41+
// After creating a section, you can append elements:
42+
$section->addText('Hello world!');
43+
44+
// You can directly style your text by giving the addText function an array:
45+
$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
46+
47+
// If you often need the same style again you can create a user defined style to the word document
48+
// and give the addText function the name of the style:
49+
$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
50+
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');
51+
52+
// You can also putthe appended element to local object an call functions like this:
53+
$myTextElement = $section->addText('Hello World!');
54+
$myTextElement->setBold();
55+
$myTextElement->setName('Verdana');
56+
$myTextElement->setSize(22);
57+
58+
// At least write the document to webspace:
59+
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
60+
$objWriter->save('helloWorld.docx');
61+
```

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2013-12-11 (v1.0):
2+
- Feature: (gavroche) Added composer file

composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "phpoffice/phpword",
3+
"description": "PHPWord - OpenXML - Read, Write and Create Word documents in PHP",
4+
"keywords": ["PHP","Word","docx","doc"],
5+
"homepage": "http://phpword.codeplex.com",
6+
"type": "library",
7+
"license": "LGPL",
8+
"authors": [
9+
{
10+
"name": "Gabriel Bull",
11+
"email": "[email protected]"
12+
}
13+
],
14+
"require": {
15+
"php": ">=5.2.0"
16+
},
17+
"autoload": {
18+
"psr-0": {
19+
"PHPWord": "src/"
20+
}
21+
}
22+
}

phpunit.xml.dist

Whitespace-only changes.

0 commit comments

Comments
 (0)