PHPackages                             laasti/route - 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. laasti/route

ActiveLibrary[Framework](/categories/framework)

laasti/route
============

Two-step controller routing for League/route. Instantiate your controller, do some stuff, then call your controller method.

v1.1.1(10y ago)1199MITPHP

Since Aug 23Pushed 10y ago1 watchersCompare

[ Source](https://github.com/laasti/route)[ Packagist](https://packagist.org/packages/laasti/route)[ RSS](/packages/laasti-route/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

Laasti/Route
============

[](#laastiroute)

An advanced implementation of PHP League Route package. A two-step route middleware for Laasti/Stack.

Instead of mapping directly to your controller, a middle step is added: a route object is used to configure the current route. This middle step can be used to check user's rights to access a route through an Authorization middleware.

Uses the excellent package from The PHP League: [League/Route](https://github.com/thephpleague/route).

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

[](#installation)

```
composer require laasti/route

```

Usage
-----

[](#usage)

Currently does not support closures nor functions as routes, only objects.

With Laasti\\Stack:

```
   $container = new League\Container;
   $routes = new League\Route\RouteCollection($container);
   $container->add('Laasti\Route\DefineControllerMiddleware')->withArgument($routes);
   $routes->setStrategy(new Laasti\Route\ControllerDefinitionStrategy);
   $request = Symfony\Component\HttpFoundation\Request::create('/test');
   $routes->get('/test', 'MyController::display');
   $resolver = new Laasti\Stack\ContainerResolver($container);
   $stack = new Laasti\Stack\Stack($resolver);
   $stack->push('Laasti\Route\DefineControllerMiddleware');
   $stack->push('Laasti\Route\CallControllerMiddleware');

   $stack->execute($request);
```

Without Laasti\\Stack:

```
   $container = new League\Container;
   $routes = new League\Route\RouteCollection($container);
   $routes->setStrategy(new Laasti\Route\ControllerDefinitionStrategy);
   $request = Symfony\Component\HttpFoundation\Request::create('/test/George');
   $routes->get('/test/{name}', 'MyController::display');

   $definition = $routes->getDispatcher()->dispatch($request->getMethod(), $request->getPathInfo());

   //Pass the request or any arguments to the controller
   //Calls MyController->display($request);
   $request->attributes->add($definition->getArguments());
   echo $definition->callController($request);

   //Or, uses route attributes as arguments
   //Calls MyController->display($name);
   echo $definition->callController();
```

Contributing
------------

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

History
-------

[](#history)

See CHANGELOG.md for more information.

Credits
-------

[](#credits)

Author: Sonia Marquette (@nebulousGirl)

License
-------

[](#license)

Released under the MIT License. See LICENSE.txt file.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~117 days

Total

3

Last Release

3686d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48bb7fdba3e642d3dc668b9ff03ff949b9043f58096f3c85c13de508b53e7d68?d=identicon)[nebulousGirl](/maintainers/nebulousGirl)

---

Top Contributors

[![nebulousGirl](https://avatars.githubusercontent.com/u/1899256?v=4)](https://github.com/nebulousGirl "nebulousGirl (16 commits)")

### Embed Badge

![Health badge](/badges/laasti-route/health.svg)

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[cakephp/core

CakePHP Framework Core classes

6126.8M39](/packages/cakephp-core)[alexbilbie/proton

Micro PHP framework

27417.4k2](/packages/alexbilbie-proton)[phprest/phprest

PHP Rest Framework.

3049.3k](/packages/phprest-phprest)

PHPackages © 2026

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