All Projects → deprecated-packages → SymfonyModularRouting

deprecated-packages / SymfonyModularRouting

Licence: MIT license
[DEPRECATED] Decouple your Symfony routing to independent, standalone services.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to SymfonyModularRouting

Jarvis-personal-assistant
Comfort of a personal assistant for Linux systems. Currently features native google, yahoo, bing searches, weather conditions, videos from youtube and looking up for images as well, all in a very reliable structure and UI.
Stars: ✭ 45 (+150%)
Mutual labels:  modular
vpc-peering-operator
A Kubernetes Operator to manage the lifecycle of AWS VPC Peering Connections
Stars: ✭ 23 (+27.78%)
Mutual labels:  routing
platframe
Structured, scalable and modular frontend development platform.
Stars: ✭ 38 (+111.11%)
Mutual labels:  modular
Modular2Recycler
Modular²Recycler is a RecyclerView.Adapter that is modular squared.
Stars: ✭ 72 (+300%)
Mutual labels:  modular
pim6sd
PIM for IPv6 sparse mode daemon
Stars: ✭ 15 (-16.67%)
Mutual labels:  routing
next-route-resolver
Declarative route definition for Next.js
Stars: ✭ 58 (+222.22%)
Mutual labels:  routing
mobx-router5
Router5 integration with mobx
Stars: ✭ 22 (+22.22%)
Mutual labels:  routing
node-match-path
Matches a URL against a path. Parameters, wildcards, RegExp.
Stars: ✭ 30 (+66.67%)
Mutual labels:  routing
spopt
Spatial Optimization
Stars: ✭ 186 (+933.33%)
Mutual labels:  routing
VaporCRUDRouter
A Rails-inspired extension to Vapor's routing system
Stars: ✭ 58 (+222.22%)
Mutual labels:  routing
pocketinternet
A Pocket Internet for teaching how the Internet really works.
Stars: ✭ 28 (+55.56%)
Mutual labels:  routing
modis
A highly modular Discord bot designed for anyone to customise and self-host.
Stars: ✭ 16 (-11.11%)
Mutual labels:  modular
plazar-js
Modular framework built with enterprise in mind - http://www.plazarjs.com
Stars: ✭ 25 (+38.89%)
Mutual labels:  modular
router
An Fully Automatic RESTful PHP Router
Stars: ✭ 51 (+183.33%)
Mutual labels:  routing
invalidroutesreporter
An ExaBGP process to elaborate and report/log invalid routes received by route servers.
Stars: ✭ 14 (-22.22%)
Mutual labels:  routing
SelectTransform
This project is based upon https://github.com/SelectTransform/st.js but differs in implementation, functionality and robustness.
Stars: ✭ 17 (-5.56%)
Mutual labels:  modular
alfred
A Modular Toolchain for JavaScript
Stars: ✭ 42 (+133.33%)
Mutual labels:  modular
bbbike
BBBike
Stars: ✭ 56 (+211.11%)
Mutual labels:  routing
p4fpga
P4-14/16 Bluespec Compiler
Stars: ✭ 70 (+288.89%)
Mutual labels:  routing
Network-Simulation-Using-Cisco-Packet-Tracer
🖧 Designed this network configuration for the network of three companies, given some constraints. Its an interesting problem demonstrating the concepts of Classless IP Subnetting and using RIPv2 Protocol.
Stars: ✭ 47 (+161.11%)
Mutual labels:  routing

Modular Routing

Build Status Downloads

To add routes you usually need to add few lines to app/config/routing.yml. If you have over dozens of modules, it would be easy to get lost in it. To see all options on how to do that including this package, read this short article.

Thanks to this router, you can add them easily as via service loader.

Install

composer require symplify/modular-routing

Add bundle to AppKernel.php:

final class AppKernel extends Kernel
{
    public function registerBundles(): array
    {
        $bundles = [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
            new Symplify\ModularRouting\SymplifyModularRoutingBundle(),
            // ...
        ];
    }
}

Usage

  1. Implement RouteCollectionProviderInterface

    use Symfony\Component\Routing\Route;
    use Symfony\Component\Routing\RouteCollection;
    use Symplify\ModularRouting\Contract\Routing\RouteCollectionProviderInterface;
    
    final class SomeRouteCollectionProvider implements RouteCollectionProviderInterface
    {
        public function getRouteCollection() : RouteCollection
        {
            $routeCollection = new RouteCollection();
            $routeCollection->add('my_route', new Route('/hello'));
    
            return $routeCollection;
        }
    }
  2. Register service

    services:
        some_module.route_provider:
            class: SomeModule\Routing\SomeRouteCollectionProvider
            autowire: true # or better use Symplify\DefaultAutowire package

That's all!

Loading YML/XML files

In case you want to load these files, just use AbstractRouteCollectionProvider with helper methods.

use Symfony\Component\Routing\RouteCollection;
use Symplify\ModularRouting\Routing\AbstractRouteCollectionProvider;

final class FilesRouteCollectionProvider extends AbstractRouteCollectionProvider
{
    public function getRouteCollection(): RouteCollection
    {
        return $this->loadRouteCollectionFromFiles([
            __DIR__ . '/routes.xml',
            __DIR__ . '/routes.yml',
        ]);
        
        // on in case you have only 1 file
        // return $this->loadRouteCollectionFromFile(__DIR__ . '/routes.yml');
    }
}

Contributing

Send issue or pull-request to main repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].