zored/zf2-to-3

Hacks for migrating from ZF2 to ZF3.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/zored/zf2-to-3

1.0 2018-01-19 21:38 UTC

This package is not auto-updated.

Last update: 2025-10-12 11:10:27 UTC


README

Build Status Coverage Status

Hacks for migrating from ZF2 to ZF3.

Why?

To fast-fix your code before fully moving to ZF3.

How?

  • use \ZF2TO3\ZF2To3AbstractFactoryTrait; in abstract factories.
  • use \ZF2TO3\ZF2To3FactoryTrait; in factories.
  • use \ZF2TO3\ZF2To3ControllerTrait; in controller itself if it depends on service locator.
  • use \ZF2TO3\ZF2To3ServiceLocatorAwareTrait; and custom constructor to get rid of ServiceLocatorAware.
  • Change controller configurations:
    <?php
    return [
        'controllers' => [
            // BEFORE:
            'invokables' => [
                'App\Some' => \App\SomeController::class
            ],
            
            // AFTER:
            'factories' => [
                // Controller should be real class:
                \App\SomeController::class => \ZF2TO3\ZF2To3ControllerFactory::class
            ],
        ],
    ];
  • Read the migration docs and get rid of these hacks!