PHPackages                             skansing/escapology - 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. [Database &amp; ORM](/categories/database)
4. /
5. skansing/escapology

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

skansing/escapology
===================

Migration router

0.1(11y ago)4171BSD-3-ClausePHPPHP &gt;=5.4.0

Since Mar 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/RonnieSkansing/Escapology)[ Packagist](https://packagist.org/packages/skansing/escapology)[ Docs](https://github.com/RonnieSkansing/Escapology)[ RSS](/packages/skansing-escapology/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (1)Used By (0)

Escapology [![Scrutinizer Code Quality](https://camo.githubusercontent.com/d272a28801f518ff73a135ac0dd212228e53dcd534ba0bd1699b6d0aa3334c02/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f526f6e6e6965536b616e73696e672f45736361706f6c6f67792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/RonnieSkansing/Escapology/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/6efe0955ea01d25acdbf89d842e146e716a18ea6f2334a00363aaa127943a7ae/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f526f6e6e6965536b616e73696e672f45736361706f6c6f67792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/RonnieSkansing/Escapology/?branch=master) [![Build Status](https://camo.githubusercontent.com/c130c9b67b97c3d0191ddde5344bfbfa5f59a69544762da788ad9283cf491a50/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f526f6e6e6965536b616e73696e672f45736361706f6c6f67792f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/RonnieSkansing/Escapology/build-status/master)
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#escapology---)

A front controller to put in front of your impossible-to-ever-refactor-into-clean-code codebase/framework.

The primary intention is to slowly and safely migrate away from a legacy codebase and into a new modern approach.

Requirements
------------

[](#requirements)

Tested against PHP 5.4, 5.5, 5.6, 7 and hhvm.

When to use
-----------

[](#when-to-use)

Use when your application is a terrible mess and your new go-to codebase/framework is fully loaded when it hits the front controller. An example of this could be migrating away from CodeIgniter/Yii to Laravel 5. At the time your clients hit Laravels front controller (router), Laravel already booted up a massive application. The performence hit of booting up the entire framework work only to route it to the old application is too much. Instead put up this library to handle the routing between old and new application until you can remove both this libary and the old application.

Suggested alternatives
----------------------

[](#suggested-alternatives)

Your new clean code dispatches to the old application if the route is not found, because it is fully decoupled and super fast from day 1.

Breaking free of your chains (framework/vendor lock in)
-------------------------------------------------------

[](#breaking-free-of-your-chains-frameworkvendor-lock-in)

*See the examples folder for examples.*

**Suggested Path of migration**

1. **Stop** building new functionality in your old codebase.
2. Setup a new codebase.
3. Setup the Escapology front controller, feed it the front controller of your old and new code base.
4. Feed the new front controller either a static route file or your new codebases. (take a look at the examples)
5. Routes found in the new code base will be sent to the new code base, any not found will be sent to the old codebase.
6. Migrate the old codebase bit by bit to the new one.
7. When all of the old codebase is gone, remove Escapology and replace it with the real front controller.

The Regex Router
----------------

[](#the-regex-router)

At the moment there is only one kind of router/dispatcher to use, the regex one.

Routes are declared in the following format

```
    return [
      // Verb, Regex URI
      ['GET', '/'],
      ['GET', '/user/\d+'],
      ['POST', '/user/'],
      ['PUT', '/user/.+'],
      // ..
    ]
```

Regular use
-----------

[](#regular-use)

As described the examples file would look something like this

```
    require __DIR__ . '/../../vendor/autoload.php';
    $applicationRouter = new Skansing\Escapology\Router\Application(
      new RegexDispatcher($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']),
      null,
      new \Skansing\Escapology\Cacher\File,
      '_route_cache'
    );
    $routeFound = $applicationRouter->handle(
      __DIR__.'/route.php'
    );
    if($routeFound) {
      // or maybe you are already in the new applications frontcontroller and can go straight to dispatching
      require __DIR__.'/newApplication/index.php';
    } else {
      require __DIR__.'/oldApplication/index.php';
    }
```

Remember to clear the cache file when new routes are set. If you only have a few routes there isnt much gain to using a cached file, but around the 100-1000 routes the benefits of not having to parse the route files are obvious.

If you want to use it uncached, simply only pass a dispatcher.

Credits
-------

[](#credits)

This package regex routing is inspired by Nikita Popov's [FastRoute](https://github.com/nikic/FastRoute/) library

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93% 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

Unknown

Total

1

Last Release

4073d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0afadee13400e7c2c151fe3fedcff681a5cbb718ed2a67e4c6e808dc313c0a74?d=identicon)[RonnieSkansing](/maintainers/RonnieSkansing)

---

Top Contributors

[![RonniSkansing](https://avatars.githubusercontent.com/u/1088060?v=4)](https://github.com/RonniSkansing "RonniSkansing (40 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (3 commits)")

---

Tags

migrationrouterrefactorfront controllerLegacy codeframework escape

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/skansing-escapology/health.svg)

```
[![Health](https://phpackages.com/badges/skansing-escapology/health.svg)](https://phpackages.com/packages/skansing-escapology)
```

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.3k123.1M6.0k](/packages/rector-rector)[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k7.4M24](/packages/kitloong-laravel-migrations-generator)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[odan/phinx-migrations-generator

Migration generator for Phinx

235847.8k23](/packages/odan-phinx-migrations-generator)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

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