Download the PHP package maglnet/magl-legacy-application without Composer
On this page you can find all versions of the php package maglnet/magl-legacy-application. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maglnet/magl-legacy-application
More information about maglnet/magl-legacy-application
Files in maglnet/magl-legacy-application
Package magl-legacy-application
Short Description Provides a laminas module that is able to run legacy applications with the power of laminas.
License BSD-3-Clause
Homepage https://github.com/maglnet/MaglLegacyApplication
Informations about the package magl-legacy-application
MaglLegacyApplication - Legacy Applications in Laminas
Run your legacy applications within Laminas.
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 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
Install through composer
Enable the module within your Laminas application.config.php
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
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
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
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:
should be changed to:
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:
should be changed to:
Using Laminas 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.
Contributing
If you have questions or problems regarding this module just open an issue or, even better, solve it and open a pull request. :+1:
All versions of magl-legacy-application with dependencies
laminas/laminas-eventmanager Version ^3.0
laminas/laminas-http Version ^2.0
laminas/laminas-mvc Version ^3.0
laminas/laminas-router Version ^3.0
laminas/laminas-servicemanager Version ^3.0
laminas/laminas-stdlib Version ^3.0
laminas/laminas-view Version ^2.5