PHPackages                             limenius/filesystem-router-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. limenius/filesystem-router-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

limenius/filesystem-router-bundle
=================================

Symfony router for static pages

281PHP

Since Jun 24Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Limenius/LimeniusFilesystemRouterBundle)[ Packagist](https://packagist.org/packages/limenius/filesystem-router-bundle)[ RSS](/packages/limenius-filesystem-router-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

LimeniusFilesystemRouterBundle
==============================

[](#limeniusfilesystemrouterbundle)

This bundle provides a Symfony chained router that adds routes for static files in a directory.

Use case: You may want to integrate the product of a static content generator engine (Sphinx, Jekyll, you name it), or you simply have some html files in a directory and you want them to be a route in your Symfony app, because you want, for instance, to...

- Embed a bunch of static html documents into a Twig template, with a menu, a sidebar.
- Generate routes to them.
- Preprocess them extracting for instance the title.
- ...

Usage
-----

[](#usage)

### Installation

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require limenius/filesystem-router-bundle

```

### Configuration

[](#configuration)

This bundle uses the Symfony CMF Dynamic router, so we need to configure it in our `app/config.yml` file:

```
cmf_routing:
    chain:
        routers_by_id:
            router.default: 200
            cmf_routing.dynamic_router: 100
    dynamic:
        route_provider_service_id: limenius_filesystem_router.route_provider
        templates_by_class:
            Limenius\Bundle\FilesystemRouterBundle\Document\ContentDocument: MyBundle:MyController:my_template.html.twig

```

Where in the last line, we have specified the template that will deal with the static content.

Also, we add some lines to confgure the bundle

```
limenius_filesystem_router:
    collections:
        Docs:
            path: "%kernel.root_dir%/Resources/my_static_directory/"
            prefix: doc

```

`collections` is a list of directories that you want to route. Every collection have a required `path` and an optional `prefix`. This bundle will create a route for every `html` file found recursively in the path.

The template that we have specified will have a `contentDocument` available:

```
{{ contentDocument |raw }}

```

### Custom controller

[](#custom-controller)

We can specify the controller that will receive the document with configuring the dynamic router with:

```
cmf_routing:
    chain:
        routers_by_id:
            router.default: 200
            cmf_routing.dynamic_router: 100
    dynamic:
        route_provider_service_id: limenius_filesystem_router.route_provider
        controllers_by_type:
            filesystem_route: Acme\MyBundle\Controller\MyController::myAction

```

Where in the last line, we have specified the action that will deal with the static content.

The action will receive the contents of the file in the variable `$contentDocument`.

It can be as simple as:

```
/**
 * @Template()
 */
public function docsAction($contentDocument)
{
    return array('content' => $contentDocument);
}

```

With a template containing:

```
{{ content | raw }}

```

Of course you can preprocess the document dealing with `$contentDocument`, for instance crawling it to extract the title or other information.

Check out your new routes with the `app/console router:debug` command.

Route generation
----------------

[](#route-generation)

Use the path of your file as in `Documentation`

Files exposed
-------------

[](#files-exposed)

By default, this bundle will only expose files with the extension `html`. You can configure it with the option `extensions_exposed`:

```
limenius_filesystem_router:
    collections:
        Docs:
            path: "%kernel.root_dir%/Resources/my_docs/_build/html"
            prefix: docs
            extensions_exposed: ['html', 'txt']

```

License
-------

[](#license)

This bundle is under the MIT license. See the complete license in the file:

```
LICENSE.md

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/47f2f35873f3e4a13655dd4efa49b60171d9a4650992544018b5e7ce463f4984?d=identicon)[nacmartin](/maintainers/nacmartin)

---

Top Contributors

[![nacmartin](https://avatars.githubusercontent.com/u/154258?v=4)](https://github.com/nacmartin "nacmartin (20 commits)")

### Embed Badge

![Health badge](/badges/limenius-filesystem-router-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/limenius-filesystem-router-bundle/health.svg)](https://phpackages.com/packages/limenius-filesystem-router-bundle)
```

###  Alternatives

[shipsaas/laravel-inbox-process

Inbox pattern process implementation for your Laravel Applications

132.5k](/packages/shipsaas-laravel-inbox-process)

PHPackages © 2026

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