Skip to content

Commit 4cb08b0

Browse files
author
Tobias Knab
committed
Upgrade to ZF3
1 parent d3dd176 commit 4cb08b0

25 files changed

+139
-189
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7
6+
- 7.1
87

98
before_script:
109
- composer update --prefer-source
@@ -14,8 +13,8 @@ script:
1413
- ./vendor/bin/phpcs --standard=PSR2 --ignore="test/Bootstrap.php" ./src/ ./test/
1514

1615
after_script:
17-
- if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
18-
- if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7' ]; then php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
16+
- if [ $TRAVIS_PHP_VERSION != '7' ] && [ $TRAVIS_PHP_VERSION != '7.1' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
17+
- if [ $TRAVIS_PHP_VERSION != '7' ] && [ $TRAVIS_PHP_VERSION != '7.1' ]; then php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
1918

2019
notifications:
2120
email: false

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2014, Tobias Knab
3+
Copyright (c) 2017, Tobias Knab
44

55
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:
66

Module.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.
@@ -22,12 +22,9 @@ class Module
2222
public function getAutoloaderConfig()
2323
{
2424
return array(
25-
'Zend\Loader\ClassMapAutoloader' => array(
26-
__DIR__ . '/autoload_classmap.php',
27-
),
2825
'Zend\Loader\StandardAutoloader' => array(
2926
'namespaces' => array(
30-
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/' , __NAMESPACE__),
27+
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
3128
),
3229
),
3330
);

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,28 @@
77
[![Total Downloads](https://poser.pugx.org/tck/zf2-imageresizer/downloads)](https://packagist.org/packages/tck/zf2-imageresizer)
88
[![License](https://poser.pugx.org/tck/zf2-imageresizer/license)](https://packagist.org/packages/tck/zf2-imageresizer)
99

10-
This ZF2 module, once enabled, allows image resizing and manipulation by url.
10+
This Zend Framework module, once enabled, allows image resizing and manipulation by url.
1111

1212

1313
### Requirements
1414

15-
* PHP 5.3+
16-
* [Zend Framework 2](https://github.com/zendframework/zf2) (> 2.0)
17-
* [Imagine](http://imagine.readthedocs.org/en/latest/) (> 0.5)
15+
* PHP 5.6+
16+
* [Zend Framework 3](https://github.com/zendframework/zendframework) (> 3.0)
17+
* [Imagine](http://imagine.readthedocs.org/en/latest/) (> 0.6)
1818

19+
> **IMPORTANT! Version notes**
20+
> * Version **2.x**: Zend Framework 3, dropped support for Zend Framework 2.
21+
> * Version **1.x**: Zend Framework 2
1922
20-
### Installation via Composer
23+
### Installation
2124

22-
Define dependencies in your composer.json file
25+
Install composer in your project
2326

24-
```json
25-
{
26-
"require": {
27-
"tck/zf2-imageresizer": "1.*"
28-
}
29-
}
30-
```
27+
curl -s http://getcomposer.org/installer | php
28+
29+
Then run
30+
31+
php composer.phar require tck/zf2-imageresizer
3132

3233

3334
### Post installation

autoload_classmap.php

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

autoload_function.php

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

autoload_register.php

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

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tck/zf2-imageresizer",
3-
"description": "Image resizer and manipulation module for Zend Framework 2",
3+
"description": "Image resizer and manipulation module for Zend Framework 3",
44
"type": "library",
55
"authors": [
66
{
@@ -20,17 +20,17 @@
2020
"MIT"
2121
],
2222
"require": {
23-
"php": ">=5.4.0",
24-
"zendframework/zend-mvc": "~2.5",
25-
"zendframework/zend-loader": "~2.5",
26-
"zendframework/zend-modulemanager": "~2.5",
27-
"zendframework/zend-config": "~2.5",
28-
"zendframework/zend-cache": "~2.5",
29-
"zendframework/zend-log": "~2.5",
30-
"zendframework/zend-view": "~2.5",
31-
"zendframework/zend-i18n": "~2.5",
32-
"zendframework/zend-console": "~2.5",
33-
"zendframework/zend-http": "~2.5",
23+
"php": "^5.6 || ^7.0",
24+
"zendframework/zend-mvc": "^3.0.1",
25+
"zendframework/zend-loader": "^2.5.1",
26+
"zendframework/zend-modulemanager": "^2.7.2",
27+
"zendframework/zend-config": "^2.6",
28+
"zendframework/zend-cache": "^2.7.1",
29+
"zendframework/zend-log": "^2.9",
30+
"zendframework/zend-view": "^2.8",
31+
"zendframework/zend-i18n": "^2.7.3",
32+
"zendframework/zend-console": "^2.6",
33+
"zendframework/zend-http": "^2.5.4",
3434
"imagine/imagine": "0.6.*"
3535
},
3636
"require-dev": {

config/module.config.php

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,66 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.
1010
*/
1111

12-
return array(
13-
'router' => array(
14-
'routes' => array(
15-
'tckimageresizer' => array(
16-
'type' => 'Literal',
17-
'options' => array(
12+
namespace TckImageResizer;
13+
14+
use Imagine\Gd\Imagine;
15+
use Zend\Router\Http\Literal;
16+
use Zend\Router\Http\Regex;
17+
use Zend\ServiceManager\Factory\InvokableFactory;
18+
19+
return [
20+
'router' => [
21+
'routes' => [
22+
'tckimageresizer' => [
23+
'type' => Literal::class,
24+
'options' => [
1825
'route' => '/processed',
19-
'defaults' => array(
20-
'__NAMESPACE__' => 'TckImageResizer\Controller',
21-
'controller' => 'Index',
26+
'defaults' => [
27+
'controller' => Controller\IndexController::class,
2228
'action' => 'index',
23-
),
24-
),
29+
],
30+
],
2531
'may_terminate' => true,
26-
'child_routes' => array(
27-
'resize' => array(
28-
'type' => 'Zend\Mvc\Router\Http\Regex',
29-
'options' => array(
32+
'child_routes' => [
33+
'resize' => [
34+
'type' => Regex::class,
35+
'options' => [
3036
'regex' => '/(?<file>.*?)\.\$(?<command>.*)\.(?<extension>[a-zA-Z]+)',
31-
'defaults' => array(
37+
'defaults' => [
3238
'action' => 'resize',
33-
),
39+
],
3440
'spec' => '/processed/%file%.$%command%.%extension%',
35-
),
36-
),
37-
),
38-
),
39-
),
40-
),
41-
'service_manager' => array(
42-
'invokables' => array(
43-
'TckImageResizerImagine' => 'Imagine\Gd\Imagine',
44-
),
45-
'factories' => array(
46-
'TckImageResizer\Service\ImageProcessing' => 'TckImageResizer\Service\ImageProcessingFactory',
47-
),
48-
),
49-
'controllers' => array(
50-
'factories' => array(
51-
'TckImageResizer\Controller\Index' => 'TckImageResizer\Controller\IndexControllerFactory',
52-
),
53-
),
54-
'view_helpers' => array(
55-
'invokables' => array(
56-
'resize' => 'TckImageResizer\View\Helper\Resize'
57-
),
58-
),
59-
);
41+
],
42+
],
43+
],
44+
],
45+
],
46+
],
47+
'service_manager' => [
48+
'aliases' => [
49+
'TckImageResizerImagine' => Imagine::class,
50+
],
51+
'factories' => [
52+
Imagine::class => InvokableFactory::class,
53+
Service\ImageProcessing::class => Service\ImageProcessingFactory::class,
54+
],
55+
],
56+
'controllers' => [
57+
'factories' => [
58+
Controller\IndexController::class => Controller\IndexControllerFactory::class,
59+
],
60+
],
61+
'view_helpers' => [
62+
'invokables' => [
63+
'resize' => View\Helper\Resize::class,
64+
],
65+
],
66+
];

src/TckImageResizer/Controller/IndexController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.
@@ -12,7 +12,6 @@
1212
namespace TckImageResizer\Controller;
1313

1414
use Zend\Mvc\Controller\AbstractActionController;
15-
use Zend\View\Model\ViewModel;
1615
use TckImageResizer\Service\ImageProcessing;
1716

1817
/**
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.
1010
*/
1111

1212
namespace TckImageResizer\Controller;
1313

14+
use Interop\Container\ContainerInterface;
15+
use TckImageResizer\Service\ImageProcessing;
1416
use Zend\ServiceManager\FactoryInterface;
1517
use Zend\ServiceManager\ServiceLocatorInterface;
1618

@@ -22,16 +24,20 @@
2224
class IndexControllerFactory implements FactoryInterface
2325
{
2426
/**
25-
* Create Service Factory
27+
* Create an IndexController object
2628
*
27-
* @param \Zend\Mvc\Controller\ControllerManager|ServiceLocatorInterface $serviceLocator
29+
* @param ContainerInterface $container
30+
* @param string $requestedName
31+
* @param null|array $options
2832
* @return IndexController
2933
*/
30-
public function createService(ServiceLocatorInterface $serviceLocator)
34+
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
3135
{
32-
$sm = $serviceLocator->getServiceLocator();
33-
$imageProcessing = $sm->get('TckImageResizer\Service\ImageProcessing');
34-
$controller = new IndexController($imageProcessing);
35-
return $controller;
36+
return new IndexController($container->get(ImageProcessing::class));
37+
}
38+
39+
public function createService(ServiceLocatorInterface $services)
40+
{
41+
return $this($services, IndexController::class);
3642
}
3743
}

src/TckImageResizer/Exception/BadMethodCallException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.

src/TckImageResizer/Service/CommandRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.

src/TckImageResizer/Service/ImageProcessing.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/**
3-
* Smart image resizing (and manipulation) by url module for Zend Framework 2
3+
* Smart image resizing (and manipulation) by url module for Zend Framework 3
44
*
55
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
6-
* @copyright Copyright (c) 2014 Tobias Knab
6+
* @copyright Copyright (c) 2017 Tobias Knab
77
*
88
* For the full copyright and license information, please view the LICENSE.txt
99
* file that was distributed with this source code.

0 commit comments

Comments
 (0)