Skip to content

Commit

Permalink
Upgrade to ZF3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Knab committed Feb 9, 2017
1 parent d3dd176 commit 4cb08b0
Show file tree
Hide file tree
Showing 25 changed files with 139 additions and 189 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7
- 7.1

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

after_script:
- if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ $TRAVIS_PHP_VERSION != '7' ]; then php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
- if [ $TRAVIS_PHP_VERSION != '7' ] && [ $TRAVIS_PHP_VERSION != '7.1' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- 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

notifications:
email: false
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2014, Tobias Knab
Copyright (c) 2017, Tobias Knab

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:

Expand Down
9 changes: 3 additions & 6 deletions Module.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
Expand All @@ -22,12 +22,9 @@ class Module
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
),
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/' , __NAMESPACE__),
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@
[![Total Downloads](https://poser.pugx.org/tck/zf2-imageresizer/downloads)](https://packagist.org/packages/tck/zf2-imageresizer)
[![License](https://poser.pugx.org/tck/zf2-imageresizer/license)](https://packagist.org/packages/tck/zf2-imageresizer)

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


### Requirements

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

> **IMPORTANT! Version notes**
> * Version **2.x**: Zend Framework 3, dropped support for Zend Framework 2.
> * Version **1.x**: Zend Framework 2
### Installation via Composer
### Installation

Define dependencies in your composer.json file
Install composer in your project

```json
{
"require": {
"tck/zf2-imageresizer": "1.*"
}
}
```
curl -s http://getcomposer.org/installer | php

Then run

php composer.phar require tck/zf2-imageresizer


### Post installation
Expand Down
13 changes: 0 additions & 13 deletions autoload_classmap.php

This file was deleted.

12 changes: 0 additions & 12 deletions autoload_function.php

This file was deleted.

2 changes: 0 additions & 2 deletions autoload_register.php

This file was deleted.

24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tck/zf2-imageresizer",
"description": "Image resizer and manipulation module for Zend Framework 2",
"description": "Image resizer and manipulation module for Zend Framework 3",
"type": "library",
"authors": [
{
Expand All @@ -20,17 +20,17 @@
"MIT"
],
"require": {
"php": ">=5.4.0",
"zendframework/zend-mvc": "~2.5",
"zendframework/zend-loader": "~2.5",
"zendframework/zend-modulemanager": "~2.5",
"zendframework/zend-config": "~2.5",
"zendframework/zend-cache": "~2.5",
"zendframework/zend-log": "~2.5",
"zendframework/zend-view": "~2.5",
"zendframework/zend-i18n": "~2.5",
"zendframework/zend-console": "~2.5",
"zendframework/zend-http": "~2.5",
"php": "^5.6 || ^7.0",
"zendframework/zend-mvc": "^3.0.1",
"zendframework/zend-loader": "^2.5.1",
"zendframework/zend-modulemanager": "^2.7.2",
"zendframework/zend-config": "^2.6",
"zendframework/zend-cache": "^2.7.1",
"zendframework/zend-log": "^2.9",
"zendframework/zend-view": "^2.8",
"zendframework/zend-i18n": "^2.7.3",
"zendframework/zend-console": "^2.6",
"zendframework/zend-http": "^2.5.4",
"imagine/imagine": "0.6.*"
},
"require-dev": {
Expand Down
95 changes: 51 additions & 44 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -1,59 +1,66 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

return array(
'router' => array(
'routes' => array(
'tckimageresizer' => array(
'type' => 'Literal',
'options' => array(
namespace TckImageResizer;

use Imagine\Gd\Imagine;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Regex;
use Zend\ServiceManager\Factory\InvokableFactory;

return [
'router' => [
'routes' => [
'tckimageresizer' => [
'type' => Literal::class,
'options' => [
'route' => '/processed',
'defaults' => array(
'__NAMESPACE__' => 'TckImageResizer\Controller',
'controller' => 'Index',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
),
),
],
],
'may_terminate' => true,
'child_routes' => array(
'resize' => array(
'type' => 'Zend\Mvc\Router\Http\Regex',
'options' => array(
'child_routes' => [
'resize' => [
'type' => Regex::class,
'options' => [
'regex' => '/(?<file>.*?)\.\$(?<command>.*)\.(?<extension>[a-zA-Z]+)',
'defaults' => array(
'defaults' => [
'action' => 'resize',
),
],
'spec' => '/processed/%file%.$%command%.%extension%',
),
),
),
),
),
),
'service_manager' => array(
'invokables' => array(
'TckImageResizerImagine' => 'Imagine\Gd\Imagine',
),
'factories' => array(
'TckImageResizer\Service\ImageProcessing' => 'TckImageResizer\Service\ImageProcessingFactory',
),
),
'controllers' => array(
'factories' => array(
'TckImageResizer\Controller\Index' => 'TckImageResizer\Controller\IndexControllerFactory',
),
),
'view_helpers' => array(
'invokables' => array(
'resize' => 'TckImageResizer\View\Helper\Resize'
),
),
);
],
],
],
],
],
],
'service_manager' => [
'aliases' => [
'TckImageResizerImagine' => Imagine::class,
],
'factories' => [
Imagine::class => InvokableFactory::class,
Service\ImageProcessing::class => Service\ImageProcessingFactory::class,
],
],
'controllers' => [
'factories' => [
Controller\IndexController::class => Controller\IndexControllerFactory::class,
],
],
'view_helpers' => [
'invokables' => [
'resize' => View\Helper\Resize::class,
],
],
];
5 changes: 2 additions & 3 deletions src/TckImageResizer/Controller/IndexController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
Expand All @@ -12,7 +12,6 @@
namespace TckImageResizer\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use TckImageResizer\Service\ImageProcessing;

/**
Expand Down
24 changes: 15 additions & 9 deletions src/TckImageResizer/Controller/IndexControllerFactory.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace TckImageResizer\Controller;

use Interop\Container\ContainerInterface;
use TckImageResizer\Service\ImageProcessing;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -22,16 +24,20 @@
class IndexControllerFactory implements FactoryInterface
{
/**
* Create Service Factory
* Create an IndexController object
*
* @param \Zend\Mvc\Controller\ControllerManager|ServiceLocatorInterface $serviceLocator
* @param ContainerInterface $container
* @param string $requestedName
* @param null|array $options
* @return IndexController
*/
public function createService(ServiceLocatorInterface $serviceLocator)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$sm = $serviceLocator->getServiceLocator();
$imageProcessing = $sm->get('TckImageResizer\Service\ImageProcessing');
$controller = new IndexController($imageProcessing);
return $controller;
return new IndexController($container->get(ImageProcessing::class));
}

public function createService(ServiceLocatorInterface $services)
{
return $this($services, IndexController::class);
}
}
4 changes: 2 additions & 2 deletions src/TckImageResizer/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions src/TckImageResizer/Service/CommandRegistry.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions src/TckImageResizer/Service/ImageProcessing.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Smart image resizing (and manipulation) by url module for Zend Framework 2
* Smart image resizing (and manipulation) by url module for Zend Framework 3
*
* @link http://github.com/tck/zf2-imageresizer for the canonical source repository
* @copyright Copyright (c) 2014 Tobias Knab
* @copyright Copyright (c) 2017 Tobias Knab
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
Expand Down
Loading

0 comments on commit 4cb08b0

Please sign in to comment.