PHPackages                             jeylabs/jsroute - 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. jeylabs/jsroute

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

jeylabs/jsroute
===============

Access Laravel Route helper functions, from JavaScript.

v1.0.2(10y ago)1269MITPHPPHP &gt;=5.4.0

Since May 28Pushed 10y agoCompare

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

READMEChangelog (1)Dependencies (7)Versions (4)Used By (0)

### Generate the `laroute.js`

[](#generate-the-laroutejs)

To access the routes, we need to "port" them over to a JavaScript file:

```
php artisan laroute:generate

```

With the default configuration, this will create a `public/js/laroute.js` file to include in your page, or build.

```

```

**Note: You'll have to `laroute:generate` if you change your routes.**

JavaScript Documentation
------------------------

[](#javascript-documentation)

By default, all of the functions are under the `laroute` namespace. This documentation will stick with this convention.

### action

[](#action)

Generate a URL for a given controller action.

```
/**
 * laroute.action(action, [parameters = {}])
 *
 * action     : The action to route to.
 * parameters : Optional. key:value object literal of route parameters.
 */

laroute.action('HomeController@getIndex');
```

### route

[](#route)

Generate a URL for a given named route.

```
/**
 * laroute.route(name, [parameters = {}])
 *
 * name       : The name of the route to route to.
 * parameters : Optional. key:value object literal of route parameters.
 */

 laroute.route('Hello.{planet}', { planet : 'world' });
```

### url

[](#url)

Generate a fully qualified URL to the given path.

```
/**
 * laroute.url(name, [parameters = []])
 *
 * name       : The name of the route to route to.
 * parameters : Optional. value array of route parameters.
 */

 laroute.url('foo/bar', ['aaa', 'bbb']); // -> /foo/bar/aaa/bbb
```

### link\_to

[](#link_to)

Generate a html link to the given url.

```
/**
 * laroute.link_to(url, [title = url, attributes = {}]])
 *
 * url        : A relative url.
 * title      : Optional. The anchor text to display
 * attributes : Optional. key:value object literal of additional html attributes.
 */

 laroute.link_to('foo/bar', 'Foo Bar', { style : "color:#bada55;" });
```

### link\_to\_route

[](#link_to_route)

Generate a html link to the given route.

```
/**
 * laroute.link_to_route(name, [title = url, parameters = {}], attributes = {}]]])
 *
 * name       : The name of the route to route to.
 * title      : Optional. The anchor text to display
 * parameters : Optional. key:value object literal of route parameters.
 * attributes : Optional. key:value object literal of additional html attributes.
 */

 laroute.link_to_route('home', 'Home');
```

### link\_to\_action

[](#link_to_action)

Generate a html link to the given action.

```
/**
 * laroute.link_to_action(action, [title = url, parameters = {}], attributes = {}]]])
 *
 * action     : The action to route to.
 * title      : Optional. The anchor text to display
 * parameters : Optional. key:value object literal of route parameters.
 * attributes : Optional. key:value object literal of additional html attributes.
 */

 laroute.link_to_action('HelloController@planet', undefined, { planet : 'world' });
```

PHP Documentation
-----------------

[](#php-documentation)

### Ignore/Filter Routes

[](#ignorefilter-routes)

By default, all routes are available to laroute after a `php artisan laroute:generate`. However, it is sometimes desirable to have laroute ignore certain routes. You can do this by passing a `laroute` route option.

```
Route::get('/ignore-me', [
    'laroute' => false,
    'as'      => 'ignoreme',
    'uses'    => 'IgnoreController@me'
]);

Route::group(['laroute' => false], function () {
    Route::get('/groups-are-super-useful', 'GroupsController@index');
});
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~2 days

Total

3

Last Release

4003d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ed0d4b2d9847ab8f33bfaa6f10e26f331104554bd9ede60a59d12ebc7cca873?d=identicon)[jeylabs](/maintainers/jeylabs)

---

Tags

laraveljavascriptroutesrouting

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jeylabs-jsroute/health.svg)

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

###  Alternatives

[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[te7a-houdini/laroute

Access Laravels URL/Route helper functions, from JavaScript.

33512.1k](/packages/te7a-houdini-laroute)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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