zenify/modular-routing

This package is abandoned and no longer maintained. The author suggests using the contributte/application package instead.

Nette extension for modular routing

0.1.2 2019-01-08 07:21 UTC

This package is auto-updated.

Last update: 2022-01-27 10:58:29 UTC


README

Build Status Quality Score Code Coverage Downloads this Month Latest stable

Install

Via Composer:

$ composer require zenify/modular-routing

Register the extension in config.neon:

extensions:
	- Zenify\ModularRouting\DI\ModularRoutingExtension

Usage

Create class implementing Zenify\ModularRouting\Routing\RouterFactoryInterface:

namespace App\Modules\SomeModule\Routing;

use Nette\Application\Routers\Route;
use Nette\Application\Routers\RouteList;
use Zenify\ModularRouting\Routing\RouterFactoryInterface;


class SomeModuleRouterFactory implements RouterFactoryInterface
{
	
	/**
	 * {@inheritdoc}
	 */
	public function create()
	{
		$router = new RouteList('SomeModule');
		$router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
		return $router;
	}
	
}

Register it to config.neon:

services:
	- App\Modules\SomeModule\Routing\SomeModuleRouterFactory

That's it!

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.