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

Laminas support #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ return array(
2012-08-26
----------

* Rewrite AsseticBundle\Service to determinate how to set up template to use resources (link, script) depending on Zend\View\Renderer
* Rewrite AsseticBundle\Service to determinate how to set up template to use resources (link, script) depending on Laminas\View\Renderer
* Assetic configuration namespace was change from:

``` php
Expand Down
16 changes: 8 additions & 8 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace AsseticBundle;

use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Laminas\EventManager\EventInterface;
use Laminas\ModuleManager\Feature\AutoloaderProviderInterface;
use Laminas\ModuleManager\Feature\BootstrapListenerInterface;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;

class Module implements
AutoloaderProviderInterface,
Expand All @@ -15,13 +15,13 @@ class Module implements
/**
* Listen to the bootstrap event
*
* @param \Zend\EventManager\EventInterface $e
* @param \Laminas\EventManager\EventInterface $e
*
* @return array
*/
public function onBootstrap(EventInterface $e)
{
/** @var $e \Zend\Mvc\MvcEvent */
/** @var $e \Laminas\Mvc\MvcEvent */
// Only attach the Listener if the request came in through http(s)
if (PHP_SAPI !== 'cli') {
$app = $e->getApplication();
Expand All @@ -41,14 +41,14 @@ public function getConfig()
}

/**
* Return an array for passing to Zend\Loader\AutoloaderFactory.
* Return an array for passing to Laminas\Loader\AutoloaderFactory.
*
* @return array
*/
public function getAutoloaderConfig()
{
return [
'Zend\Loader\StandardAutoloader' => [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__ . '/'
],
Expand Down
4 changes: 2 additions & 2 deletions bin/assetic
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ if (!file_exists('config/application.config.php')) {

$appConfig = include 'config/application.config.php';
if (file_exists('config/development.config.php')) {
$appConfig = Zend\Stdlib\ArrayUtils::merge($appConfig, include 'config/development.config.php');
$appConfig = Laminas\Stdlib\ArrayUtils::merge($appConfig, include 'config/development.config.php');
}

// init Zend Application
$application = \Zend\Mvc\Application::init($appConfig);
$application = \Laminas\Mvc\Application::init($appConfig);

/* @var $cli \Symfony\Console\Application */
$cli = $application->getServiceManager()->get('AsseticBundle\Cli');
Expand Down
101 changes: 52 additions & 49 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
{
"name": "widmogrod/zf2-assetic-module",
"type": "library",
"description": "Zend Framework 2 module that provides complete integration of Assetic library",
"keywords": [
"assetic",
"assets",
"resources",
"css",
"js",
"less"
],
"homepage": "https://github.com/widmogrod/zf2-assetic-module",
"license": "MIT",
"authors": [
{
"name": "Gabriel Habryn",
"email": "[email protected]",
"homepage": "https://github.com/widmogrod/zf2-assetic-module",
"role": "Developer"
}
],
"bin": [
"bin/assetic"
],
"require": {
"php": "^5.6 || ^7.0",
"kriswallsmith/assetic": "^1.2",
"widmogrod/php-functional": "^1.0",
"zendframework/zend-mvc": "^3.0",
"symfony/console": "^3.1.3"
},
"require-dev": {
"phpunit/phpunit": "^5.4",
"fabpot/php-cs-fixer": "^1.12"
},
"suggest": {
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
"leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler"
},
"scripts": {
"test": "phpunit",
"fix-code": "php-cs-fixer fix",
"check-code": "php-cs-fixer fix --verbose --diff --dry-run"
},
"autoload": {
"psr-0": {
"AsseticBundle": "src"
"name": "widmogrod/zf2-assetic-module",
"type": "library",
"description": "Zend Framework 2 module that provides complete integration of Assetic library",
"keywords": [
"assetic",
"assets",
"resources",
"css",
"js",
"less"
],
"homepage": "https://github.com/widmogrod/zf2-assetic-module",
"license": "MIT",
"authors": [
{
"name": "Gabriel Habryn",
"email": "[email protected]",
"homepage": "https://github.com/widmogrod/zf2-assetic-module",
"role": "Developer"
}
],
"bin": [
"bin/assetic"
],
"require": {
"php": "^5.6 || ^7.0",
"kriswallsmith/assetic": "^1.2",
"widmogrod/php-functional": "^1.0",
"laminas/laminas-mvc": "^3.0",
"symfony/console": "^3.1.3",
"laminas/laminas-dependency-plugin": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^5.4",
"fabpot/php-cs-fixer": "^1.12"
},
"suggest": {
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
"leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler"
},
"classmap": ["Module.php"]
}
"scripts": {
"test": "phpunit",
"fix-code": "php-cs-fixer fix",
"check-code": "php-cs-fixer fix --verbose --diff --dry-run"
},
"autoload": {
"psr-0": {
"AsseticBundle": "src"
},
"classmap": [
"Module.php"
]
}
}
12 changes: 6 additions & 6 deletions configs/module.config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Zend\Mvc\Application;
use Laminas\Mvc\Application;

return [
'service_manager' => [
Expand All @@ -13,18 +13,18 @@
'AsseticBundle\Service' => 'AsseticBundle\ServiceFactory',
'Assetic\AssetWriter' => 'AsseticBundle\WriterFactory',
'AsseticBundle\FilterManager' => 'AsseticBundle\FilterManagerFactory',
'Assetic\AssetManager' => 'Zend\ServiceManager\Factory\InvokableFactory',
'AsseticBundle\Listener' => 'Zend\ServiceManager\Factory\InvokableFactory',
'Assetic\AssetManager' => 'Laminas\ServiceManager\Factory\InvokableFactory',
'AsseticBundle\Listener' => 'Laminas\ServiceManager\Factory\InvokableFactory',
'AsseticBundle\Cli' => 'AsseticBundle\Cli\ApplicationFactory',
'AsseticBundle\Configuration' => 'AsseticBundle\Factory\ConfigurationFactory',
],
],

'assetic_configuration' => [
'rendererToStrategy' => [
'Zend\View\Renderer\PhpRenderer' => 'AsseticBundle\View\ViewHelperStrategy',
'Zend\View\Renderer\FeedRenderer' => 'AsseticBundle\View\NoneStrategy',
'Zend\View\Renderer\JsonRenderer' => 'AsseticBundle\View\NoneStrategy',
'Laminas\View\Renderer\PhpRenderer' => 'AsseticBundle\View\ViewHelperStrategy',
'Laminas\View\Renderer\FeedRenderer' => 'AsseticBundle\View\NoneStrategy',
'Laminas\View\Renderer\JsonRenderer' => 'AsseticBundle\View\NoneStrategy',
],
'acceptableErrors' => [
Application::ERROR_CONTROLLER_NOT_FOUND,
Expand Down
6 changes: 3 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ Also,….

| Renderer | Strategy |
|----------|-----------|
| `Zend\View\Renderer\PhpRenderer` | `AsseticBundle\View\ViewHelperStrategy`
| `Zend\View\Renderer\FeedRenderer` | `AsseticBundle\View\NoneStrategy`
| `Zend\View\Renderer\JsonRenderer` | `AsseticBundle\View\NoneStrategy`
| `Laminas\View\Renderer\PhpRenderer` | `AsseticBundle\View\ViewHelperStrategy`
| `Laminas\View\Renderer\FeedRenderer` | `AsseticBundle\View\NoneStrategy`
| `Laminas\View\Renderer\JsonRenderer` | `AsseticBundle\View\NoneStrategy`

### AcceptableErrors

Expand Down
6 changes: 3 additions & 3 deletions docs/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Step by step introduction, how to use `AsseticBundle` with `ZF3`

#### [Install ZF3 skeleton application](https://github.com/zendframework/ZendSkeletonApplication)
```
composer create-project zendframework/skeleton-application path/to/project
composer create-project laminas/skeleton-application path/to/project
```

#### Enter ZF3 directory
Expand All @@ -20,8 +20,8 @@ composer require widmogrod/zf2-assetic-module
#### Declare `AsseticBundle` in the `config/modules.config.php` file:
```php
return [
'Zend\Router',
'Zend\Validator',
'Laminas\Router',
'Laminas\Validator',
'AsseticBundle', // <-- put it here
'Application',
];
Expand Down
4 changes: 2 additions & 2 deletions docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To enable it you only need to specify which cache buster strategy you want to us

```php
use AsseticBundle\CacheBuster\LastModifiedStrategy;
use Zend\ServiceManager\Factory\InvokableFactory;
use Laminas\ServiceManager\Factory\InvokableFactory;

return [
'service_manager' => [
Expand All @@ -93,7 +93,7 @@ return [
Please note anyone using `zf2-assetic-module` with `ZfcRbac` you will experience this same issue on (Access Denied)[https://github.com/widmogrod/zf2-assetic-module/pull/41]. This is due to the white list of acceptable errors in assetic. You will need to allow the firewall errors in your assetic configuration to get css on your access denied pages:

```
use Zend\Mvc\Application;
use Laminas\Mvc\Application;
use ZfcRbac\Guard\GuardInterface;

return array(
Expand Down
4 changes: 2 additions & 2 deletions src/AsseticBundle/Cli/ApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Interop\Container\ContainerInterface;
use Symfony\Component\Console\Application;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class ApplicationFactory implements FactoryInterface
{
Expand Down
8 changes: 4 additions & 4 deletions src/AsseticBundle/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace AsseticBundle;

use Zend\Stdlib;
use Laminas\Stdlib;

class Configuration
{
Expand Down Expand Up @@ -51,7 +51,7 @@ class Configuration
/**
* The base url.
*
* By default this value is set from "\Zend\Http\PhpEnvironment\Request::getBaseUrl()"
* By default this value is set from "\Laminas\Http\PhpEnvironment\Request::getBaseUrl()"
*
* Example:
* <code>
Expand All @@ -65,7 +65,7 @@ class Configuration
/**
* The base path.
*
* By default this value is set from "\Zend\Http\PhpEnvironment\Request::getBasePath()"
* By default this value is set from "\Laminas\Http\PhpEnvironment\Request::getBasePath()"
*
* Example:
* <code>
Expand Down Expand Up @@ -116,7 +116,7 @@ class Configuration

/**
* Map of strategies that will be choose to setup Assetic\AssetInterface
* for particular Zend\View\Renderer\RendererInterface
* for particular Laminas\View\Renderer\RendererInterface
*
* @var array
*/
Expand Down
2 changes: 1 addition & 1 deletion src/AsseticBundle/Factory/ConfigurationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use AsseticBundle\Configuration;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;

class ConfigurationFactory implements FactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/AsseticBundle/FilterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Assetic\Filter\FilterInterface;
use Assetic\FilterManager as AsseticFilterManager;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class FilterManager extends AsseticFilterManager
{
Expand Down
4 changes: 2 additions & 2 deletions src/AsseticBundle/FilterManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace AsseticBundle;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class FilterManagerFactory implements FactoryInterface
{
Expand Down
10 changes: 5 additions & 5 deletions src/AsseticBundle/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace AsseticBundle;

use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\ListenerAggregateInterface;
use Zend\Http\PhpEnvironment\Response;
use Zend\Mvc\MvcEvent;
use Zend\Stdlib\CallbackHandler;
use Laminas\EventManager\EventManagerInterface;
use Laminas\EventManager\ListenerAggregateInterface;
use Laminas\Http\PhpEnvironment\Response;
use Laminas\Mvc\MvcEvent;
use Laminas\Stdlib\CallbackHandler;

class Listener implements ListenerAggregateInterface
{
Expand Down
8 changes: 4 additions & 4 deletions src/AsseticBundle/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Assetic\Asset\AssetInterface;
use Assetic\Asset\AssetCache;
use Assetic\Cache\FilesystemCache;
use Zend\View\Renderer\RendererInterface as Renderer;
use Laminas\View\Renderer\RendererInterface as Renderer;
use AsseticBundle\View\StrategyInterface;

class Service
Expand Down Expand Up @@ -325,7 +325,7 @@ public function setupRendererFromOptions(Renderer $renderer, array $options)
}

/**
* @param \Zend\View\Renderer\RendererInterface $renderer
* @param \Laminas\View\Renderer\RendererInterface $renderer
*
* @return bool
*/
Expand All @@ -339,7 +339,7 @@ public function hasStrategyForRenderer(Renderer $renderer)
/**
* Get strategy to setup assets for given $renderer.
*
* @param \Zend\View\Renderer\RendererInterface $renderer
* @param \Laminas\View\Renderer\RendererInterface $renderer
*
* @throws Exception\DomainException
* @throws Exception\InvalidArgumentException
Expand Down Expand Up @@ -388,7 +388,7 @@ public function getStrategyForRenderer(Renderer $renderer)
/**
* Get renderer name from $renderer object.
*
* @param \Zend\View\Renderer\RendererInterface $renderer
* @param \Laminas\View\Renderer\RendererInterface $renderer
*
* @return string
*/
Expand Down
Loading