PHPackages                             maglnet/magl-legacy-application - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. maglnet/magl-legacy-application

ActiveLibrary[Framework](/categories/framework)

maglnet/magl-legacy-application
===============================

Provides a laminas module that is able to run legacy applications with the power of laminas.

1.13.0(4y ago)441.9k↓39.6%4BSD-3-ClausePHPPHP ^7.3 || ^8.0

Since May 29Pushed 4y ago4 watchersCompare

[ Source](https://github.com/maglnet/MaglLegacyApplication)[ Packagist](https://packagist.org/packages/maglnet/magl-legacy-application)[ Docs](https://github.com/maglnet/MaglLegacyApplication)[ RSS](/packages/maglnet-magl-legacy-application/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (23)Used By (0)

MaglLegacyApplication - Legacy Applications in Laminas
======================================================

[](#magllegacyapplication---legacy-applications-in-laminas)

[![Latest Stable Version](https://camo.githubusercontent.com/40b9f8e757de8e03d8ab42ea4f58619188da96fe8972bb5abd8cd26d10433ed1/68747470733a2f2f706f7365722e707567782e6f72672f6d61676c6e65742f6d61676c2d6c65676163792d6170706c69636174696f6e2f762f737461626c652e737667)](https://packagist.org/packages/maglnet/magl-legacy-application)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/09f3dfe658ff15f71e41d1aac7fc1883248e6452863452922490d631bee6cb19/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61676c6e65742f4d61676c4c65676163794170706c69636174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maglnet/MaglLegacyApplication/?branch=master)[![License](https://camo.githubusercontent.com/4625266561bb60aeebbd401372d10323269f79a3a41e72adf17ac52dc003ca03/68747470733a2f2f706f7365722e707567782e6f72672f6d61676c6e65742f6d61676c2d6c65676163792d6170706c69636174696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/maglnet/magl-legacy-application)[![Build Status](https://camo.githubusercontent.com/0580ee1a0e50887a5255a740592d399c77a8f14da75e38670a132246f9ad97a1/68747470733a2f2f7472617669732d63692e6f72672f6d61676c6e65742f4d61676c4c65676163794170706c69636174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/maglnet/MaglLegacyApplication)[![Code Coverage](https://camo.githubusercontent.com/a7a276e1480b569a36df4975dfa34ef3730d7c87bfdcdc0c4230bf6382cd144b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61676c6e65742f4d61676c4c65676163794170706c69636174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maglnet/MaglLegacyApplication/?branch=master)

Run your legacy applications within Laminas.

Introduction
------------

[](#introduction)

Since rewriting your legacy application from scratch to a Laminas application could be nearly impossible due to time, effort, and resources, I was searching for a way to migrate a legacy application to a Laminas application.

A [great article by Chris Abernethy](http://www.chrisabernethy.com/zend-framework-legacy-scripts/) described a way on how to run your legacy application within ZF1, so I migrated this HowTo to a small Laminas module, to be able to run a legacy application within Laminas.

While running your legacy application within a Laminas application it is possible to slowly migrate an existing application to Laminas by leaving your old application (nearly - see "Adjust your legacy Application") untouched and build new modules with the power of Laminas.
By adding a simple wrapper (see "Using Laminas within your legacy application") you could also use the new modules within your legacy application.

Installation
------------

[](#installation)

Install through composer

```
{
    "require" : {
        "maglnet/magl-legacy-application" : "*"
    }
}
```

Enable the module within your Laminas `application.config.php`

```
    'modules' => array(
        'Application',
        'MaglLegacyApplication',
    ),
```

Copy the provided file `data/magl-laminas-legacy-wrapper.php` to your `public/` folder.
Copy the provided file `data/.htaccess` to your publix folder.
Copy your legacy Application to your `public/` folder.

Your legacy application should now run within Laminas. :)

Configuration
-------------

[](#configuration)

For any SEO optimized route within your legacy application, add a route to the zend router that routes to legacy controller and remove the mod\_rewrite rules from your `.htaccess`

```
return array(
    'router' => array(
        'routes' => array(
            // example for transferring mod rewrite rules to laminas routes
            'legacy-seo-calendar' => array(
                'type' => 'Laminas\Mvc\Router\Http\Regex',
                'options' => array(
                    'regex'    => '/calendar/(?.+)',
                    'defaults' => array(
                        'controller' => 'MaglLegacyApplication\Controller\Legacy',
                        'action'     => 'index',
                        'script'     => 'index-already-seo-optimized.php',
                    ),
                    'spec' => '/',
                ),
            ),
        ),
    ),
);
```

Adjust your legacy Application
------------------------------

[](#adjust-your-legacy-application)

There are several cases in which your legacy application won't run without additional adjustments, here are some of them:

### Relative Paths

[](#relative-paths)

Using relative paths for `require`, `require_once` or `includes` will possibly fail now, since Laminas will do a `chdir()`to the Laminas' application root. So you will need to adjust your paths to match the new root.

Example:

```
include '../lib/somelib.php';
```

should be changed to:

```
include __DIR__ . '/../lib/somelib.php';
```

### Using Globals / Server `SCRIPT_FILENAME` or `SCRIPT_NAME`

[](#using-globals--server-script_filename-or-script_name)

Because of `mod_rewrite` rules, `SCRIPT_FILENAME` and `SCRIPT_NAME` won't be your real script anymore. If you use these variables, you need to adjust these places within your legacy application:

Example:

```
$script_filename = $_SERVER['SCRIPT_FILENAME'];
$script_name     = $_SERVER['SCRIPT_NAME'];
```

should be changed to:

```
use MaglLegacyApplication\Application\MaglLegacy;
$legacy          = MaglLegacy::getInstance();
$script_filename = $legacy->getLegacyScriptFilename();
$script_name     = $legacy->getLegacyScriptName();
```

Using Laminas within your legacy application
--------------------------------------------

[](#using-laminas-within-your-legacy-application)

```
use MaglLegacyApplication\Application\MaglLegacy;
$application = MaglLegacy::getInstance()->getApplication();
$yourService = $application->getServiceManager()->get('YourService');
```

Injecting responses from within your legacy application
-------------------------------------------------------

[](#injecting-responses-from-within-your-legacy-application)

from wherever you are within your legacy application, it is possible to bypass your legacy applications controller code and send a response to the Laminas Controller wrapper. This response will then be handled like within a normal Laminas controller.

```
use MaglLegacyApplication\Application\MaglLegacy;
$application = MaglLegacy::getInstance()->getApplication();
$application->getEventManager()->getSharedManager()->attach('*', MaglLegacy::EVENT_SHORT_CIRCUIT_RESPONSE, function(Event $e){
    $response = new \Laminas\Http\Response();
    $response->setStatusCode(404);
    $response->setContent('not found');
    $e->stopPropagation(true);
    return $response;
});
```

Contributing
============

[](#contributing)

If you have questions or problems regarding this module just open an issue or, even better, solve it and open a pull request. 👍

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~138 days

Recently: every ~208 days

Total

20

Last Release

1741d ago

Major Versions

0.1.0 → 1.0.02014-06-15

PHP version history (4 changes)0.1.0PHP &gt;=5.3.0

1.8.0PHP ^5.6|^7.0

1.10.0PHP ^7.0

1.13.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed8ff51781adb3e444537560551a30438894fe5c3d427a8e0574ba1ed81088f5?d=identicon)[maglnet](/maintainers/maglnet)

---

Top Contributors

[![maglnet](https://avatars.githubusercontent.com/u/4430279?v=4)](https://github.com/maglnet "maglnet (90 commits)")[![luked3v3l0p3r](https://avatars.githubusercontent.com/u/26403393?v=4)](https://github.com/luked3v3l0p3r "luked3v3l0p3r (2 commits)")

---

Tags

laminaslegacylegacy application

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maglnet-magl-legacy-application/health.svg)

```
[![Health](https://phpackages.com/badges/maglnet-magl-legacy-application/health.svg)](https://phpackages.com/packages/maglnet-magl-legacy-application)
```

###  Alternatives

[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[laminas/laminas-mvc

Laminas's event-driven MVC layer, including MVC Applications, Controllers, and Plugins

17224.4M365](/packages/laminas-laminas-mvc)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[laminas-api-tools/api-tools-admin

Laminas API Tools Admin module

13794.3k5](/packages/laminas-api-tools-api-tools-admin)[laminas-api-tools/api-tools

Laminas API Tools module for Laminas

371.7M10](/packages/laminas-api-tools-api-tools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
