Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Zf3 #73

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
language: php

env:
- ZF_VERSION=^2.4
- ZF_VERSION=2.4.*
- ZF_VERSION=2.5.*

php:
- 5.6
- 7.0
- 7.1

before_install:
- composer require --update-with-dependencies zendframework/zend-loader:${ZF_VERSION} zendframework/zend-servicemanager:${ZF_VERSION} zendframework/zend-modulemanager:${ZF_VERSION} zendframework/zend-mvc:${ZF_VERSION} zendframework/zend-view:${ZF_VERSION} zendframework/zend-serializer:${ZF_VERSION} zendframework/zend-log:${ZF_VERSION} zendframework/zend-i18n:${ZF_VERSION} zendframework/zend-http:${ZF_VERSION} zendframework/zend-console:${ZF_VERSION}

script: ./build.sh

after_success:
Expand Down
67 changes: 23 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
DOMPDFModule
DompdfModule
============

[![Build Status](https://secure.travis-ci.org/raykolbe/DOMPDFModule.png?branch=master)](http://travis-ci.org/raykolbe/DOMPDFModule) [![Code Climate](https://codeclimate.com/github/raykolbe/DOMPDFModule/badges/gpa.svg)](https://codeclimate.com/github/raykolbe/DOMPDFModule) [![Test Coverage](https://codeclimate.com/github/raykolbe/DOMPDFModule/badges/coverage.svg)](https://codeclimate.com/github/raykolbe/DOMPDFModule/coverage) [![Total Downloads](https://poser.pugx.org/dino/dompdf-module/downloads)](https://packagist.org/packages/dino/dompdf-module) [![License](https://poser.pugx.org/dino/dompdf-module/license)](https://packagist.org/packages/dino/dompdf-module)

The DOMPDF module integrates the DOMPDF library with Zend Framework 2 with minimal effort on the consumer's end.
DompdfModule integrates the [Dompdf](https://github.com/dompdf/dompdf) library with Zend Framework.

## Requirements
- [Zend Framework 2](http://www.github.com/zendframework/zf2)
- PHP 5.6+
- [Zend Framework](https://github.com/zendframework/zendframework)

## Installation
Installation of DOMPDFModule uses PHP Composer. For more information about
PHP Composer, please visit the official [PHP Composer site](http://getcomposer.org/).

#### Installation steps

1. `cd my/project/directory`
2. create a `composer.json` file with following contents:

```json
{
"require": {
"dino/dompdf-module": "dev-master"
}
}
```
3. install PHP Composer via `curl -s http://getcomposer.org/installer | php` (on windows, download
http://getcomposer.org/installer and execute it with PHP)
4. run `php composer.phar install`
5. open `my/project/directory/config/application.config.php` and add the following key to your `modules`:

```php
'DOMPDFModule',
```
It is recommended that you use [Composer](http://getcomposer.org/) to install this package.

```
composer require dino/dompdf-module
```

#### Configuration options
You can override options via the `dompdf_module` key in your local or global config files. See DOMPDFModule/config/module.config.php for config options.
You can override options via the `dompdf_module` key in your local or global config files. See DompdfModule/config/module.config.php for config options.

## Usage

Expand All @@ -43,24 +27,22 @@ You can override options via the `dompdf_module` key in your local or global con
namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use DOMPDFModule\View\Model\PdfModel;
use DompdfModule\View\Model\PdfModel;

class ReportController extends AbstractActionController
{
public function monthlyReportPdfAction()
{
$pdf = new PdfModel();
$pdf->setOption('fileName', 'monthly-report'); // "pdf" extension is automatically appended
$pdf->setOption('display', PdfModel::DISPLAY_ATTACHMENT); // Triggers browser to prompt "save as" dialog
$pdf->setOption('paperSize', 'a4'); // Defaults to "8x11"
$pdf->setOption('paperOrientation', 'landscape'); // Defaults to "portrait"

// To set view variables
$pdf->setVariables(array(
'message' => 'Hello'
));

return $pdf;
return (new PdfModel())
->setOptions([
'fileName' => 'monthly-report',
'display' => PdfModel::DISPLAY_ATTACHMENT,
'paperSize' => 'a4',
'paperOrientation' => 'landscape'
])
->setVariables([
'message' => 'Hello'
]);
}
}
```
Expand Down Expand Up @@ -91,7 +73,4 @@ By default, builds executed using Docker are done so using the [latest stable ve
```
docker build --build-arg PHP_VERSION=5.6 --tag dino/dompdf-module-php56 .
docker run -v composer-cache:/var/lib/composer -v ${PWD}:/opt/app dino/dompdf-module-php56
```

## To-do
- Add command line support.
```
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ composer --prefer-dist install
php -l ${PROJECT_ROOT}/src
php -l ${PROJECT_ROOT}/config
php -l ${PROJECT_ROOT}/tests
php -l ${PROJECT_ROOT}/Module.php

# ------------------------------------------------------------------
# Test
Expand Down
24 changes: 7 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dino/dompdf-module",
"type": "library",
"description": "A Zend Framework 2 module for incorporating DOMPDF support.",
"description": "A Zend Framework 2 module for incorporating Dompdf support.",
"keywords": ["pdf","dompdf", "zf2"],
"homepage": "http://raymondkolbe.com",
"license": "MIT",
Expand All @@ -13,33 +13,23 @@
],
"require": {
"php": ">=5.6",
"zendframework/zend-loader": "^2.4",
"zendframework/zend-servicemanager": "^2.4",
"zendframework/zend-modulemanager": "^2.4",
"zendframework/zend-mvc": "^2.4",
"zendframework/zend-view": "^2.4",
"zendframework/zend-serializer": "^2.4",
"zendframework/zend-log": "^2.4",
"zendframework/zend-i18n": "^2.4",
"zendframework/zend-http": "^2.4",
"zendframework/zend-console": "^2.4",
"dompdf/dompdf": "^0.8.0"
"dompdf/dompdf": "^0.8.0",
"zendframework/zend-mvc": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.27",
"codeclimate/php-test-reporter": "^0.3.2",
"fabpot/php-cs-fixer": "^1.12",
"squizlabs/php_codesniffer": "^2.7",
"phpmd/phpmd": "^2.4"
},
"autoload": {
"psr-0": {
"DOMPDFModule": "src/"
"psr-4": {
"DompdfModule\\": "src"
}
},
"autoload-dev": {
"psr-0": {
"DOMPDFModuleTest": "tests/"
"psr-4": {
"DompdfModule\\": "tests/DompdfModule"
}
}
}
Loading