-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from PHPOffice/wmf
Github Action : Documentation
- Loading branch information
Showing
10 changed files
with
354 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
### MkDocs | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- name: Install Python Dependencies | ||
run: pip install mkdocs-material autolink-references-mkdocs-plugin | ||
- name: Build documentation | ||
run: mkdocs build --site-dir public | ||
### PHPUnit | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.1 | ||
extensions: dom, xml | ||
coverage: xdebug | ||
- name: Create directory public/coverage | ||
run: mkdir ./public/coverage | ||
- name: Install PHP Dependencies | ||
run: composer install --ansi --prefer-dist --no-interaction --no-progress | ||
- name: Build Coverage Report | ||
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./public/coverage | ||
### PHPDoc | ||
#- name: Create directory public/docs | ||
# run: mkdir ./public/docs | ||
#- name: Install PhpDocumentor | ||
# run: wget https://phpdoc.org/phpDocumentor.phar && chmod +x phpDocumentor.phar | ||
#- name: Build Documentation | ||
# run: ./phpDocumentor.phar run -d ./src -t ./public/docs | ||
|
||
### Deploy | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,7 @@ | |
.phpunit.result.cache | ||
.php-cs-fixer.cache | ||
composer.lock | ||
phpDocumentor.phar | ||
|
||
public/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 PhpSpreadsheet Authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# WMF | ||
|
||
[![Latest Stable Version](https://poser.pugx.org/phpoffice/wmf/v)](https://packagist.org/packages/phpoffice/wmf) | ||
[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/WMF/badge.svg?branch=master)](https://coveralls.io/github/PHPOffice/WMF?branch=master) | ||
[![Total Downloads](https://poser.pugx.org/phpoffice/wmf/downloads)](https://packagist.org/packages/phpoffice/wmf) | ||
[![License](https://poser.pugx.org/phpoffice/wmf/license)](https://packagist.org/packages/phpoffice/wmf) | ||
[![CI](https://github.com/PHPOffice/WMF/actions/workflows/php.yml/badge.svg)](https://github.com/PHPOffice/WMF/actions/workflows/php.yml) | ||
|
||
WMF is a library written in pure PHP that provides a set of classes to read WMF based file (like `.wmf` or `.emf` files). | ||
|
||
WMF is an open source project licensed under the terms of [MIT](https://github.com/PHPOffice/WMF/blob/master/LICENCE). WMF is aimed to be a high quality software product by incorporating [continuous integration and unit testing](https://github.com/PHPOffice/WMF/actions/workflows/php.yml). You can learn more about WMF by reading this Developers'Documentation and the [API Documentation](http://phpoffice.github.io/WMF/docs/develop/) | ||
|
||
If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpoffice-wmf) | ||
|
||
Read more about WMF: | ||
|
||
- [Features](#features) | ||
- [Requirements](#requirements) | ||
- [Installation](#installation) | ||
- [Contributing](#contributing) | ||
- [Developers' Documentation](https://phpoffice.github.io/WMF/) | ||
|
||
## Features | ||
|
||
- Read files | ||
|
||
* WMF files | ||
* (EMF files, not for the moment) | ||
* (EMF+ files, not for the moment) | ||
|
||
## Requirements | ||
|
||
WMF requires the following: | ||
|
||
- PHP 7.1+ | ||
|
||
## Installation | ||
|
||
WMF is installed via [Composer](https://getcomposer.org/). | ||
To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to WMF in your project, either | ||
|
||
Run the following to use the latest stable version | ||
```sh | ||
composer require phpoffice/wmf | ||
``` | ||
or if you want the latest unreleased version | ||
```sh | ||
composer require phpoffice/wmf:dev-master | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome everyone to contribute to PHPWord. Below are some of the things that you can do to contribute. | ||
|
||
- [Fork us](https://github.com/PHPOffice/WMF/fork) and [request a pull](https://github.com/PHPOffice/WMF/pulls) to the [master](https://github.com/PHPOffice/WMF/tree/master) branch. | ||
- Submit [bug reports or feature requests](https://github.com/PHPOffice/WMF/issues) to GitHub. | ||
- Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 0.1.0 | ||
|
||
## Enhancements | ||
|
||
- Initial version by [@Progi1984](https://github/Progi1984) | ||
- Enable/Disable Exceptions in [#3](https://github.com/PHPOffice/WMF/pull/3) by [@Progi1984](https://github/Progi1984) | ||
|
||
## Bug fixes | ||
|
||
- N/A | ||
|
||
## Miscellaneous | ||
|
||
- Github Action : PHP (PHPCSFixer / PHPStan / PHPUnit) in [#1](https://github.com/PHPOffice/WMF/pull/1) by [@Progi1984](https://github/Progi1984) | ||
- Refactored WMF Reader in [#2](https://github.com/PHPOffice/WMF/pull/2) by [@Progi1984](https://github/Progi1984) | ||
- Github Action : Documentation in [#4](https://github.com/PHPOffice/WMF/pull/4) by [@Progi1984](https://github/Progi1984) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## References | ||
|
||
### WMF | ||
|
||
### EMF | ||
|
||
### EMF+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
|
||
WMF is a library written in pure PHP that provides a set of classes to read WMF based file (like `.wmf` or `.emf` files). | ||
|
||
WMF is an open source project licensed under the terms of [MIT](https://github.com/PHPOffice/WMF/blob/master/LICENCE). WMF is aimed to be a high quality software product by incorporating [continuous integration and unit testing](https://github.com/PHPOffice/WMF/actions/workflows/php.yml). You can learn more about WMF by reading this Developers'Documentation and the [API Documentation](http://phpoffice.github.io/WMF/docs/develop/) | ||
|
||
## Features | ||
|
||
- Read files | ||
|
||
* WMF files | ||
* (EMF files, not for the moment) | ||
* (EMF+ files, not for the moment) | ||
|
||
## Contributing | ||
|
||
We welcome everyone to contribute to WMF. Below are some of the things that you can do to contribute: | ||
|
||
- [Fork us](https://github.com/PHPOffice/WMF/fork) and [request a pull](https://github.com/PHPOffice/WMF/pulls) to the [master](https://github.com/PHPOffice/WMF/tree/master) branch | ||
- Submit [bug reports or feature requests](https://github.com/PHPOffice/WMF/issues) to GitHub | ||
- Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Installation | ||
|
||
## Requirements | ||
|
||
Mandatory: | ||
|
||
- PHP 7.1+ | ||
|
||
## Installation | ||
|
||
### Using Composer | ||
|
||
To install via [Composer](http://getcomposer.org), add the following lines to your `composer.json`: | ||
|
||
``` json | ||
{ | ||
"require": { | ||
"phpoffice/wmf": "dev-master" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# WMF | ||
|
||
You can load `.wmf` files. | ||
|
||
## Backends | ||
|
||
You can one of two current backends : `gd` or `imagick`. | ||
If you don't know which one used, you can use the magic one. | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\GD; | ||
use PhpOffice\WMF\Reader\WMF\Imagick; | ||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
// Choose which backend you want | ||
$reader = new GD(); | ||
$reader = new Imagick(); | ||
$reader = new Magic(); | ||
|
||
$reader->load('sample.wmf'); | ||
``` | ||
|
||
For next sample, I will use the magic one. | ||
|
||
## Methods | ||
|
||
### `getResource` | ||
|
||
The method returns the resource used in internal by the library. | ||
|
||
The `GD` backend returns a `GDImage` object or resource, depending the PHP version. | ||
The `Imagick` backend returns a `Imagick` object. | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
$reader = new Magic(); | ||
|
||
$wmf = $reader->load('sample.wmf'); | ||
|
||
var_dump($wmf->getResource()); | ||
``` | ||
|
||
### `getMediaType` | ||
|
||
The method returns the media type for a WMF file | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
$reader = new Magic(); | ||
|
||
$mediaType = $reader->getMediaType(); | ||
|
||
echo 'The media type for a WMF file is ' . $$mediaType; | ||
``` | ||
|
||
### `isWMF` | ||
|
||
The method allows to know if the file is supported by the library. | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
$reader = new Magic(); | ||
|
||
$isWMF = $reader->isWMF('sample.wmf'); | ||
|
||
echo 'The file sample.wmf ' . ($isWMF ? 'is a WMF file' : 'is not a WMF file'); | ||
``` | ||
|
||
### `load` | ||
|
||
The method load a WMF file in the object | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
$reader = new Magic(); | ||
|
||
$wmf = $reader->load('sample.wmf'); | ||
``` | ||
|
||
### `save` | ||
|
||
The method transforms the loaded WMF file in an another image. | ||
|
||
```php | ||
<?php | ||
|
||
use PhpOffice\WMF\Reader\WMF\Magic; | ||
|
||
$reader = new Magic(); | ||
|
||
$wmf = $reader->load('sample.wmf'); | ||
$wmf->save('sample.png', 'png'); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
site_name: WMF | ||
site_url: https://phpoffice.github.io/WMF | ||
repo_url: https://github.com/PHPOffice/WMF | ||
repo_name: PHPOffice/WMF | ||
edit_uri: edit/master/docs/ | ||
|
||
## Theme | ||
theme: | ||
name: material | ||
palette: | ||
primary: grey | ||
features: | ||
- search.highlight | ||
- search.suggest | ||
|
||
## Plugins | ||
plugins: | ||
- search | ||
|
||
## Config | ||
extra: | ||
generator: false | ||
extra_javascript: | ||
- https://polyfill.io/v3/polyfill.min.js?features=es6 | ||
markdown_extensions: | ||
## Syntax highlighting | ||
- pymdownx.highlight | ||
- pymdownx.superfences | ||
## Support for emojis | ||
- pymdownx.emoji: | ||
emoji_index: !!python/name:materialx.emoji.twemoji | ||
emoji_generator: !!python/name:materialx.emoji.to_svg | ||
## Support for call-outs | ||
- admonition | ||
- pymdownx.details | ||
use_directory_urls: false | ||
|
||
## Navigation | ||
nav: | ||
- Introduction: 'index.md' | ||
- Install: 'install.md' | ||
- Usage: | ||
- WMF: 'usage/wmf.md' | ||
- Credits: 'credits.md' | ||
- Releases: | ||
- '0.1.0 (WIP)': 'changes/0.1.0.md' | ||
- Developers: | ||
- 'Coveralls': 'https://coveralls.io/github/PHPOffice/WMF' | ||
- 'Code Coverage': 'coverage/index.html' | ||
- 'PHPDoc': 'docs/index.html' |