PHPackages                             rpsimao/laravel-js-routing - 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. rpsimao/laravel-js-routing

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rpsimao/laravel-js-routing
==========================

Laravel 5 package to access Routing from Javascript

2.1.1(8y ago)055MITPHPPHP &gt;=7.1.0

Since Sep 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rpsimao/laravel-js-routing)[ Packagist](https://packagist.org/packages/rpsimao/laravel-js-routing)[ RSS](/packages/rpsimao-laravel-js-routing/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (12)Used By (0)

Javascript Routing for Laravel 5
================================

[](#javascript-routing-for-laravel-5)

This package allows you to access Laravel's routing from your Javascript.

The main feature is the possibility to use it easily in local and production environment.

In local environment, the JS routes are re-written each request. In production environment, the JS routes are dumped in a static file for better performance.

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

[](#installation)

Add this line to your **composer.json** and run `composer update`

```
"delormejonathan/laravel-js-routing": "~2.0"

```

Only for (Laravel &lt;5.5) Add the provider to **app.php** to the **providers** section

```
DelormeJonathan\LaravelJsRouting\LaravelJsRoutingServiceProvider::class,

```

Only for (Laravel &lt;5.5) Add the facade to **app.php** to the **aliases** section

```
'JSRouter' => DelormeJonathan\LaravelJsRouting\Facades\JSRouter::class,

```

Publish assets to public folder

```
php artisan vendor:publish --tag=public --force

```

Usage
-----

[](#usage)

Call the JSRouter plugin in your application template :

```

```

And import routes file dynamically in local and statically in production :

```
@if (App::environment() == 'production')

@else
	{!! JSRouter::generate() !!}
@endif
```

Now, you can use it in JavaScript :

```
JSRouter.action('UsersController@edit', { id : 5 }); // For routes without a name
JSRouter.route('mycustomroutename'); // For routes with a name
```

Don't forget to export routes in production. You can add a custom path right after the 'dump' word. Default path is : public/js/routes.js

```
php artisan laravel-js-routing:dump
```

```
php artisan laravel-js-routing:dump public/mycustompath/mycustomfile.js
```

Configuration
-------------

[](#configuration)

You can change the default path with the configuration file. You have to publish the config file :

```
php artisan config:publish delormejonathan/laravel-js-routing
```

Then modify it in app/config/packages.

Common issues
-------------

[](#common-issues)

**Browser console report "No routes detected"**

Make sure you have at least one route with a name or a controller in your routes.php.

**I added a route to Laravel and the JSRouter doesn't see it**

If you are in production environment, remember to export your routes with *php artisan laravel-js-routing:dump* when you change your routes.php

If you are in local environment, remember that your route needs to point to a controller. It can have a name (optional). This package doesn't work with Closure routes.

Contribution &amp; improvements
-------------------------------

[](#contribution--improvements)

The plugin is pretty basic currently. He needs a better parsing engine to manage optional parameters.

Issues or features
------------------

[](#issues-or-features)

Feel free to open an issue if you encounter a problem or contact me directly.

Credits
-------

[](#credits)

- [FOSJsRoutingBundle](https://github.com/FriendsOfSymfony/FOSJsRoutingBundle) for the inspiration.

License
-------

[](#license)

This project is licensed under the MIT license.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~134 days

Recently: every ~150 days

Total

11

Last Release

2932d ago

Major Versions

v1.0.5 → v2.0.02016-09-08

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

2.1PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b20557c62a96fca9a58d80b11dffbaf4e3debd77d9358c66ed06d413c1e884a7?d=identicon)[rpsimao](/maintainers/rpsimao)

---

Top Contributors

[![delormejonathan](https://avatars.githubusercontent.com/u/5949870?v=4)](https://github.com/delormejonathan "delormejonathan (20 commits)")[![nteath](https://avatars.githubusercontent.com/u/1489566?v=4)](https://github.com/nteath "nteath (4 commits)")[![septagram](https://avatars.githubusercontent.com/u/5250951?v=4)](https://github.com/septagram "septagram (1 commits)")

---

Tags

laravelrouting

### Embed Badge

![Health badge](/badges/rpsimao-laravel-js-routing/health.svg)

```
[![Health](https://phpackages.com/badges/rpsimao-laravel-js-routing/health.svg)](https://phpackages.com/packages/rpsimao-laravel-js-routing)
```

###  Alternatives

[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)

PHPackages © 2026

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