Added support for composer
This commit is contained in:
parent
f58524b262
commit
8c4efdd607
|
|
@ -1,5 +1,14 @@
|
||||||
|
.DS_Store
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
Thumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
.idea
|
||||||
|
phpunit.xml
|
||||||
|
composer.lock
|
||||||
|
vendor
|
||||||
/.settings
|
/.settings
|
||||||
/.buildpath
|
/.buildpath
|
||||||
/.project
|
/.project
|
||||||
/docs
|
/docs
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
language: php
|
||||||
|
|
||||||
|
php:
|
||||||
|
- 5.3
|
||||||
|
- 5.4
|
||||||
|
- 5.5
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- curl -s http://getcomposer.org/installer | php
|
||||||
|
- php composer.phar install --dev --prefer-source
|
||||||
56
README.md
56
README.md
|
|
@ -1,9 +1,61 @@
|
||||||
# PHPWord - OpenXML - Read, Write and Create Word documents in PHP
|
# PHPWord - OpenXML - Read, Write and Create Word documents in PHP
|
||||||
|
|
||||||
PHPWord is a library written in PHP that create word documents.
|
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.
|
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?
|
## Want to contribute?
|
||||||
Fork us!
|
Fork us!
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* PHP version 5.2.0 or higher
|
||||||
|
|
||||||
## License
|
## License
|
||||||
PHPWord is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPWord/blob/master/license.md)
|
PHPWord is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPWord/blob/master/license.md)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add
|
||||||
|
the following lines to your ``composer.json``.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"phpoffice/phpword": "dev-master"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The following is a basic example of the PHPWord library.
|
||||||
|
|
||||||
|
```php
|
||||||
|
// Create a new PHPWord Object
|
||||||
|
$PHPWord = new PHPWord();
|
||||||
|
|
||||||
|
// Every element you want to append to the word document is placed in a section. So you need a section:
|
||||||
|
$section = $PHPWord->createSection();
|
||||||
|
|
||||||
|
// After creating a section, you can append elements:
|
||||||
|
$section->addText('Hello world!');
|
||||||
|
|
||||||
|
// You can directly style your text by giving the addText function an array:
|
||||||
|
$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
|
||||||
|
|
||||||
|
// If you often need the same style again you can create a user defined style to the word document
|
||||||
|
// and give the addText function the name of the style:
|
||||||
|
$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
|
||||||
|
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');
|
||||||
|
|
||||||
|
// You can also putthe appended element to local object an call functions like this:
|
||||||
|
$myTextElement = $section->addText('Hello World!');
|
||||||
|
$myTextElement->setBold();
|
||||||
|
$myTextElement->setName('Verdana');
|
||||||
|
$myTextElement->setSize(22);
|
||||||
|
|
||||||
|
// At least write the document to webspace:
|
||||||
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
|
$objWriter->save('helloWorld.docx');
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
2013-12-11 (v1.0):
|
||||||
|
- Feature: (gavroche) Added composer file
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "phpoffice/phpword",
|
||||||
|
"description": "PHPWord - OpenXML - Read, Write and Create Word documents in PHP",
|
||||||
|
"keywords": ["PHP","Word","docx","doc"],
|
||||||
|
"homepage": "http://phpword.codeplex.com",
|
||||||
|
"type": "library",
|
||||||
|
"license": "LGPL",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Gabriel Bull",
|
||||||
|
"email": "gavroche.bull@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"PHPWord": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue