Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c52b229
Allow up to sensio/framework-extra-bundle v5
Jean85 Apr 20, 2018
d613645
Update the readme
Jean85 May 15, 2019
4bec249
Rework the CI config
Jean85 May 15, 2019
492a188
Require PHP 7.1
Jean85 May 15, 2019
a18c690
Drop env variables in CI
Jean85 May 15, 2019
cc93575
Do not lock Symfony version
Jean85 May 15, 2019
fa566cf
Remove wrong option in CI composer install
Jean85 May 15, 2019
fabdcf0
Change dir structure, use PSR-4 and src-tests splitting
Jean85 May 15, 2019
e657453
Merge pull request #1 from facile-it/change-dir-structure
Jean85 May 15, 2019
22e9e26
Merge pull request #3 from facile-it/allow-fwextra-5
Jean85 May 15, 2019
44f7328
Disable memory limit in CI for Composer
Jean85 May 15, 2019
fa2b4b6
Require single symfony components (and sub-dependencies)
Jean85 May 15, 2019
c7ebb37
Require and use the deprecations listener
Jean85 May 15, 2019
e6a76ba
Fix CI script
Jean85 May 15, 2019
f38c9c3
Merge pull request #2 from facile-it/require-symfony-components
Jean85 May 15, 2019
97ce92b
Require newer PHPUnit versions
Jean85 May 15, 2019
6537c75
Migrate tests classes
Jean85 May 15, 2019
ba833e4
Use ::class in tests where possible
Jean85 May 15, 2019
88a00b2
Fix tests
Jean85 May 15, 2019
9279bec
Merge pull request #4 from facile-it/update-phpunit
Jean85 May 15, 2019
89c01d3
Add coveralls
Jean85 May 15, 2019
2184434
Add coverage badge
Jean85 May 15, 2019
66a696f
Require Symfony 3.4 or 4
Jean85 May 15, 2019
0ecdc02
Resolve (or ignore) deprecations
Jean85 May 15, 2019
389a4de
Port getRootDir to get around deprecation
Jean85 May 15, 2019
b63557d
Increase lower bound constraint for PHPUnit to avoid deprecation
Jean85 May 16, 2019
89cf267
Disable deprecation helper in CI prefer-lowest
Jean85 May 16, 2019
e2573e9
Merge pull request #5 from facile-it/update-symfony
Jean85 May 16, 2019
d79147c
Require CS-fixer
Jean85 May 16, 2019
92e2dc5
Add basic config
Jean85 May 16, 2019
99ea492
Apply basic CS config to codebase
Jean85 May 16, 2019
d9d7118
Apply more advanced CS rules
Jean85 May 16, 2019
ae960a8
Add CS check in CI
Jean85 May 16, 2019
e581437
Merge pull request #6 from facile-it/code-style
Jean85 May 16, 2019
95f0d49
Update ExampleController.php
Jean85 May 17, 2019
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.iml
.idea
vendor/
composer.lock
composer.lock
/.php_cs.cache
27 changes: 27 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$config = PhpCsFixer\Config::create();
$config->setRiskyAllowed(true);
$config->setRules([
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'psr4' => true,
]);

$finder = PhpCsFixer\Finder::create();
$finder->in([
'src',
'tests',
]);

$config->setFinder($finder);

return $config;
69 changes: 27 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
language: php
sudo: false

cache:
directories:
- $HOME/.composer/cache/files

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.3
- 7.2
- 7.1

env:
- COMPOSER_MEMORY_LIMIT=-1

before_install:
- composer self-update
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
- composer require --no-update symfony/framework-bundle "$SYMFONY_VERSION"

install:
- composer install --prefer-source

script: vendor/bin/phpunit --configuration Tests/phpunit.xml
- composer install --prefer-dist --no-interaction

env:
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
script: vendor/bin/phpunit

matrix:
jobs:
include:
- php: 5.5
env: SYMFONY_VERSION=3.0.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
- php: 7.0
env: SYMFONY_VERSION=3.0.*
- php: 7.1
env: SYMFONY_VERSION=3.0.*

- php: 7.0
env: SYMFONY_VERSION=3.1.*
- php: 7.1
env: SYMFONY_VERSION=3.1.*

- php: 7.0
env: SYMFONY_VERSION=3.2.*
- php: 7.1
env: SYMFONY_VERSION=3.2.*

- php: 7.1
env: SYMFONY_VERSION=3.3.*

sudo: false

cache:
directories:
- $HOME/.composer/cache

- stage: Test
php: 7.1
name: prefer-lowest
env:
- SYMFONY_DEPRECATIONS_HELPER=disabled
install:
- composer remove --dev friendsofphp/php-cs-fixer --no-update
- composer update --no-interaction --prefer-dist --prefer-stable --prefer-lowest
- stage: Additional checks
name: Test coverage
script: phpdbg -qrr vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml --coverage-text
after_success:
- php vendor/bin/php-coveralls -v
- name: Code style
script: vendor/bin/php-cs-fixer fix --verbose --dry-run
41 changes: 23 additions & 18 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
PsPdfBundle
===========

[![Build Status](https://secure.travis-ci.org/psliwa/PdfBundle.png?branch=master)](http://travis-ci.org/psliwa/PdfBundle)
[![Build Status](https://travis-ci.org/facile-it/PdfBundle.svg?branch=symfony4)](https://travis-ci.org/facile-it/PdfBundle)
[![Coverage Status](https://coveralls.io/repos/github/facile-it/PdfBundle/badge.svg?branch=symfony4)](https://coveralls.io/github/facile-it/PdfBundle?branch=symfony4)

This bundle integrates Symfony2 with [PHPPdf][1] library. Thanks to this bundle you can easily generate PDF or image (png, jpg) files.
This bundle is a fork of [psliwa/PdfBundle](https://github.com/psliwa/PdfBundle); this branch (`symfony4`) aims at updating all the dependencies of this bundle to make it work with Symfony 4 and Symfony Flex. To check on what has been done, look at [the relative milestone](https://github.com/facile-it/PdfBundle/milestone/1).

This bundle integrates Symfony (3.4/4.x) with [PHPPdf][1] library. Thanks to this bundle you can easily generate PDF or image (png, jpg) files.

Documentation of [PHPPdf][1] you can find on github (README file).

Installation
------------

1. Use composer. PsPdfBundle requires "minimum-stability" equals to dev. Run this command:

composer require psliwa/pdf-bundle

2. Register bundle in AppKernel:

//app/AppKernel.php
public function registerBundles()
{
return array(
// ..
new Ps\PdfBundle\PsPdfBundle(),
// ..
);
}
1. Use composer
```bash
composer require psliwa/pdf-bundle
```

2. Register bundle in AppKernel:

```php
//app/AppKernel.php
public function registerBundles()
{
return [
// ..
new Ps\PdfBundle\PsPdfBundle(),
// ..
];
}
```

Configuration
-------------
Expand Down
62 changes: 0 additions & 62 deletions Tests/Annotation/PdfTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions Tests/phpunit.xml

This file was deleted.

31 changes: 24 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "psliwa/pdf-bundle",
"description": "This bundle integrates Symfony2 with PHPPdf library.",
"description": "This bundle integrates Symfony 3.4/4 with PHPPdf library.",
"keywords": ["PDF", "PHPPdf"],
"type": "symfony-bundle",
"license": "MIT",
Expand All @@ -11,17 +11,34 @@
"email": "[email protected]"
}
],
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"require": {
"php": ">=5.3.0",
"symfony/symfony": "~2.3|~3.0",
"php": "^7.1",
"doctrine/annotations": "^1.0",
"psliwa/php-pdf": "^1.1.5",
"sensio/framework-extra-bundle": ">=2.0 <4.0.0"
"sensio/framework-extra-bundle": "^2|^3|^4|^5",
"symfony/config": "^3.4|^4.0",
"symfony/dependency-injection": "^3.4|^4.0",
"symfony/event-dispatcher": "^3.4|^4.0",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/http-foundation": "^3.4|^4.0",
"symfony/http-kernel": "^3.4|^4.0",
"symfony/templating": "^3.4|^4.0",
"twig/twig": "^1.0|^2.0"
},
"require-dev": {
"phpunit/phpunit": ">=4,<6.0.0"
"friendsofphp/php-cs-fixer": "^2.15",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^7.5.11|^8.0",
"symfony/phpunit-bridge": "^4.2"
},
"autoload": {
"psr-0": { "Ps\\PdfBundle": "" }
"psr-4": { "Ps\\PdfBundle\\": "src" }
},
"target-dir": "Ps/PdfBundle"
"autoload-dev": {
"psr-4": { "Ps\\PdfBundle\\Tests\\": "tests" }
}
}
26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.5/phpunit.xsd"
colors="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
cacheResult="false"
bootstrap="vendor/autoload.php">

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="PdfBundle">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
21 changes: 9 additions & 12 deletions Annotation/Pdf.php → src/Annotation/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@
use Doctrine\Common\Annotations\Annotation;

/**
* Pdf annotation
*
* Pdf annotation.
*
* @Annotation
*
* @author Piotr Śliwa <[email protected]>
*/
class Pdf
{
public $stylesheet;
public $documentParserType = 'xml';
public $headers = array();
public $headers = [];
public $enableCache = false;

public function __construct(array $values)
{
$currentValues = get_object_vars($this);

foreach($values as $key => $value)
{
if(array_key_exists($key, $currentValues))
{

foreach ($values as $key => $value) {
if (array_key_exists($key, $currentValues)) {
$this->$key = $value;
}
else
{
} else {
throw new \InvalidArgumentException(sprintf('Argument "%s" for @Pdf() annotation is unsupported.', $key));
}
}
}
}
}
Loading