Skip to content

Commit 8fa9ead

Browse files
committed
Merge branch 'release/2.0.0'
2 parents d1ab190 + 950195c commit 8fa9ead

File tree

13 files changed

+23
-208
lines changed

13 files changed

+23
-208
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,16 @@ jobs:
4848
matrix:
4949
php:
5050
- '7.4'
51-
- '8.0'
5251
- '8.1'
5352
- '8.2'
5453
include:
5554
- description: 'Symfony 5.4'
5655
php: '7.4'
5756
symfony: 5.4.*
5857
composer_option: '--prefer-lowest'
59-
- description: 'Symfony 6.0'
60-
php: '8.0'
61-
symfony: 6.0.*
62-
- description: 'Symfony 6.1'
63-
php: '8.1'
64-
symfony: 6.1.*
58+
- description: 'Symfony 5.4'
59+
php: '8.2'
60+
symfony: 5.4.*
6561
- description: 'Symfony 6.2'
6662
php: '8.2'
6763
symfony: 6.2.*

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## 2.0.0 - 2023-01-16
10+
### Changed
11+
- Drop support for unsupported php-weasyprint versions
12+
- Bump Symfony 6 support to >= 6.2
13+
14+
### Removed
15+
- Remove deprecate Image response
16+
917
## 1.4.0 - 2023-01-16
1018
### Added
1119
- Add support for php-weasyprint 0.13

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ weasyprint:
3535
enabled: true
3636
binary: /usr/local/bin/weasyprint
3737
options: []
38-
image:
39-
enabled: true
40-
binary: /usr/local/bin/weasyprint
41-
options: []
4238
```
4339
4440
If you want to change temporary folder which is ```sys_get_temp_dir()``` by default, you can use
@@ -59,10 +55,9 @@ weasyprint:
5955

6056
## Usage
6157

62-
The bundle registers two services:
58+
The bundle registers one service:
6359

6460
- the `weasyprint.pdf` service allows you to generate pdf files.
65-
- the `weasyprint.image` service allows you to generate images (works only with WeasyPrint 52.5 or lower);
6661

6762
### Generate a pdf document from a URL
6863

@@ -134,4 +129,4 @@ class SomeController extends AbstractController
134129
## Credits
135130

136131
WeasyPrintBundle and [PhpWeasyPrint](https://github.com/pontedilana/php-weasyprint) has been developed by [Pontedilana](https://www.pontedilana.it/).
137-
SnappyBundle has been developed by [KnpLabs](https://knplabs.com).
132+
SnappyBundle has been developed by [KnpLabs](https://knplabs.com).

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
],
1818
"require": {
1919
"php": "7.4.* || 8.0.* || 8.1.* || 8.2.*",
20-
"pontedilana/php-weasyprint": "^0.10 || ^0.11 || ^0.12 || ^0.13 || ^1.0",
21-
"symfony/config": "^5.4 || ^6.0",
22-
"symfony/dependency-injection": "^5.4 || ^6.0",
23-
"symfony/http-foundation": "^5.4 || ^6.0",
24-
"symfony/http-kernel": "^5.4 || ^6.0"
20+
"pontedilana/php-weasyprint": "^1.0",
21+
"symfony/config": "^5.4 || ^6.2",
22+
"symfony/dependency-injection": "^5.4 || ^6.2",
23+
"symfony/http-foundation": "^5.4 || ^6.2",
24+
"symfony/http-kernel": "^5.4 || ^6.2"
2525
},
2626
"require-dev": {
2727
"doctrine/annotations": "^1.11",
@@ -31,10 +31,10 @@
3131
"phpstan/phpstan-phpunit": "^1.0",
3232
"phpstan/phpstan-symfony": "^1.0",
3333
"phpunit/phpunit": "^9.5",
34-
"symfony/framework-bundle": "^5.4 || ^6.0",
35-
"symfony/phpunit-bridge": "^5.4 || ^6.0",
36-
"symfony/validator": "^5.4 || ^6.0",
37-
"symfony/yaml": "^5.4 || ^6.0"
34+
"symfony/framework-bundle": "^5.4 || ^6.2",
35+
"symfony/phpunit-bridge": "^5.4 || ^6.2",
36+
"symfony/validator": "^5.4 || ^6.2",
37+
"symfony/yaml": "^5.4 || ^6.2"
3838
},
3939
"autoload": {
4040
"psr-4": {

config/image.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,6 @@ public function getConfigTreeBuilder(): TreeBuilder
4646
->end()
4747
->end()
4848
->end()
49-
->arrayNode('image')
50-
->canBeEnabled()
51-
->children()
52-
->booleanNode('enabled')->defaultFalse()->end()
53-
->scalarNode('binary')->defaultValue('weasyprint')->end()
54-
->arrayNode('options')
55-
->performNoDeepMerging()
56-
->useAttributeAsKey('name')
57-
->beforeNormalization()
58-
->always($fixOptionKeys)
59-
->end()
60-
->prototype('scalar')->end()
61-
->end()
62-
->arrayNode('env')
63-
->prototype('scalar')->end()
64-
->end()
65-
->end()
66-
->end()
6749
->end();
6850

6951
return $treeBuilder;

src/DependencyInjection/WeasyprintExtension.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,5 @@ public function load(array $configs, ContainerBuilder $container): void
3737
->addMethodCall('setTimeout', [$config['process_timeout']]);
3838
}
3939
}
40-
41-
if ($config['image']['enabled']) {
42-
$loader->load('image.xml');
43-
44-
$container->setParameter('weasyprint.image.binary', $config['image']['binary']);
45-
$container->setParameter('weasyprint.image.options', $config['image']['options']);
46-
$container->setParameter('weasyprint.image.env', $config['image']['env']);
47-
48-
if (!empty($config['temporary_folder'])) {
49-
$container->findDefinition('weasyprint.image')
50-
->addMethodCall('setTemporaryFolder', [$config['temporary_folder']]);
51-
}
52-
if (!empty($config['process_timeout'])) {
53-
$container->findDefinition('weasyprint.image')
54-
->addMethodCall('setTimeout', [$config['process_timeout']]);
55-
}
56-
}
5740
}
5841
}

src/WeasyPrint/Response/ImageResponse.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ public function dataForProcessedConfiguration(): array
3838
'options' => [],
3939
'env' => [],
4040
],
41-
'image' => [
42-
'enabled' => false,
43-
'binary' => 'weasyprint',
44-
'options' => [],
45-
'env' => [],
46-
],
4741
],
4842
],
4943
[
@@ -54,12 +48,6 @@ public function dataForProcessedConfiguration(): array
5448
'options' => ['foo' => 'bar'],
5549
'env' => [],
5650
],
57-
'image' => [
58-
'enabled' => true,
59-
'binary' => '/path/to/weasyprint',
60-
'options' => ['baz' => 'bat', 'baf' => 'bag'],
61-
'env' => [],
62-
],
6351
],
6452
[
6553
'pdf' => [
@@ -75,12 +63,6 @@ public function dataForProcessedConfiguration(): array
7563
'options' => ['bak' => 'bap'],
7664
'env' => [],
7765
],
78-
'image' => [
79-
'enabled' => true,
80-
'binary' => '/path/to/weasyprint',
81-
'options' => ['baz' => 'bat', 'baf' => 'bag'],
82-
'env' => [],
83-
],
8466
],
8567
],
8668
[
@@ -94,12 +76,6 @@ public function dataForProcessedConfiguration(): array
9476
'options' => [],
9577
'env' => [],
9678
],
97-
'image' => [
98-
'enabled' => false,
99-
'binary' => 'weasyprint',
100-
'options' => [],
101-
'env' => [],
102-
],
10379
],
10480
],
10581
[
@@ -111,12 +87,6 @@ public function dataForProcessedConfiguration(): array
11187
],
11288
'env' => [],
11389
],
114-
'image' => [
115-
'options' => [
116-
'bag-baf' => 'bak',
117-
],
118-
'env' => [],
119-
],
12090
],
12191
],
12292
[
@@ -128,14 +98,6 @@ public function dataForProcessedConfiguration(): array
12898
],
12999
'env' => [],
130100
],
131-
'image' => [
132-
'enabled' => true,
133-
'binary' => 'weasyprint',
134-
'options' => [
135-
'bag-baf' => 'bak',
136-
],
137-
'env' => [],
138-
],
139101
],
140102
],
141103
[
@@ -152,12 +114,6 @@ public function dataForProcessedConfiguration(): array
152114
'options' => [],
153115
'env' => [],
154116
],
155-
'image' => [
156-
'enabled' => false,
157-
'binary' => 'weasyprint',
158-
'options' => [],
159-
'env' => [],
160-
],
161117
],
162118
],
163119
];

tests/FunctionalTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Pontedilana\WeasyprintBundle\Tests;
44

55
use PHPUnit\Framework\TestCase;
6-
use Pontedilana\PhpWeasyPrint\Image;
76
use Pontedilana\PhpWeasyPrint\Pdf;
87
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
98
use Symfony\Component\Filesystem\Filesystem;
@@ -40,11 +39,6 @@ public function testServiceIsAvailableOutOfTheBox(): void
4039

4140
$this->assertInstanceof(Pdf::class, $pdf);
4241
$this->assertEquals('weasyprint', $pdf->getBinary());
43-
44-
$this->assertFalse($container->has('weasyprint.image'), 'The image service is available.');
45-
46-
$this->expectException(ServiceNotFoundException::class);
47-
$image = $container->get('weasyprint.image');
4842
}
4943

5044
public function testChangeBinaries(): void
@@ -60,13 +54,6 @@ public function testChangeBinaries(): void
6054

6155
$this->assertInstanceof(Pdf::class, $pdf);
6256
$this->assertEquals('/custom/binary/for/weasyprint', $pdf->getBinary());
63-
64-
$this->assertTrue($container->has('weasyprint.image'));
65-
66-
$image = $container->get('weasyprint.image');
67-
68-
$this->assertInstanceof(Image::class, $image);
69-
$this->assertEquals('/custom/binary/for/weasyprint', $image->getBinary());
7057
}
7158

7259
public function testChangeTemporaryFolder(): void
@@ -90,15 +77,4 @@ public function testDisablePdf(): void
9077

9178
$this->assertFalse($container->has('weasyprint.pdf'), 'The pdf service is NOT available.');
9279
}
93-
94-
public function testEnableImage(): void
95-
{
96-
$this->kernel->setConfigurationFilename(__DIR__ . '/fixtures/config/enable_image.yml');
97-
$this->kernel->boot();
98-
99-
$container = $this->kernel->getContainer();
100-
101-
$this->assertTrue($container->has('weasyprint.pdf'), 'The pdf service is available.');
102-
$this->assertTrue($container->has('weasyprint.image'), 'The image service is NOT available.');
103-
}
10480
}

0 commit comments

Comments
 (0)