PHPackages                             dogadogmbh/laroute - 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. dogadogmbh/laroute

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

dogadogmbh/laroute
==================

Access Laravels URL/Route helper functions, from JavaScript.

3.0.0(5y ago)04.0kMITPHPPHP ^7.2.5|^8.0

Since Mar 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dogadogmbh/laroute)[ Packagist](https://packagist.org/packages/dogadogmbh/laroute)[ RSS](/packages/dogadogmbh-laroute/feed)WikiDiscussions 3.0 Synced 2mo ago

READMEChangelog (5)Dependencies (8)Versions (27)Used By (0)

Laroute
=======

[](#laroute)

---

### Forked from [aaronlord/laroute](https://github.com/aaronlord/laroute) for security and updated laravel versions

[](#forked-from-aaronlordlaroute-for-security-and-updated-laravel-versions)

[Laravel](http://laravel.com/) has some pretty sweet [helper functions](http://laravel.com/docs/helpers#urls) for generating urls/links and its auto-json-magic makes it building APIs super easy. It's my go-to choice for building single-page js apps, but routing can quickly become a bit of a pain.

Wouldn't it be amazing if we could access our Laravel routes from JavaScript?

This package allows us to port our routes over to JavaScript, and gives us a bunch of *very familiar* helper functions to use.

[![Laroute in action](laroute.png)](laroute.png)

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

[](#installation)

Install with the usual [composer](https://getcomposer.org/) way.

```
composer require dogado/laroute
```

### Configure (optional)

[](#configure-optional)

Copy the packages config files.

```
php artisan vendor:publish --provider='Dogado\Laroute\LarouteServiceProvider'

```

### 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.

### 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');
```

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');
});
```

Licence
-------

[](#licence)

[View the licence in this repo.](https://github.com/dogadogmbh/laroute/blob/master/LICENSE)

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~215 days

Total

25

Last Release

1932d ago

Major Versions

v1.3.2 → v2.0.02015-02-13

2.5.3 → 3.0.x-dev2021-01-23

PHP version history (4 changes)v1.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=5.4.0

2.5.0PHP &gt;=5.6.0

3.0.x-devPHP ^7.2.5|^8.0

### Community

Maintainers

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

---

Top Contributors

[![darthsoup](https://avatars.githubusercontent.com/u/1668978?v=4)](https://github.com/darthsoup "darthsoup (23 commits)")[![aaronlord](https://avatars.githubusercontent.com/u/1591606?v=4)](https://github.com/aaronlord "aaronlord (17 commits)")[![rtheunissen](https://avatars.githubusercontent.com/u/809191?v=4)](https://github.com/rtheunissen "rtheunissen (5 commits)")[![lukepolo](https://avatars.githubusercontent.com/u/2066668?v=4)](https://github.com/lukepolo "lukepolo (3 commits)")[![jipe47](https://avatars.githubusercontent.com/u/1380202?v=4)](https://github.com/jipe47 "jipe47 (3 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (2 commits)")[![martdegraaf](https://avatars.githubusercontent.com/u/9855233?v=4)](https://github.com/martdegraaf "martdegraaf (2 commits)")[![killtw](https://avatars.githubusercontent.com/u/1076225?v=4)](https://github.com/killtw "killtw (1 commits)")[![Crinsane](https://avatars.githubusercontent.com/u/1297781?v=4)](https://github.com/Crinsane "Crinsane (1 commits)")[![reecss](https://avatars.githubusercontent.com/u/2707732?v=4)](https://github.com/reecss "reecss (1 commits)")[![Anahkiasen](https://avatars.githubusercontent.com/u/1321596?v=4)](https://github.com/Anahkiasen "Anahkiasen (1 commits)")[![Schnoop](https://avatars.githubusercontent.com/u/1263407?v=4)](https://github.com/Schnoop "Schnoop (1 commits)")[![tvbeek](https://avatars.githubusercontent.com/u/2026498?v=4)](https://github.com/tvbeek "tvbeek (1 commits)")[![xeno010](https://avatars.githubusercontent.com/u/5448179?v=4)](https://github.com/xeno010 "xeno010 (1 commits)")[![dbpolito](https://avatars.githubusercontent.com/u/347400?v=4)](https://github.com/dbpolito "dbpolito (1 commits)")[![jscarmona](https://avatars.githubusercontent.com/u/7995069?v=4)](https://github.com/jscarmona "jscarmona (1 commits)")

---

Tags

laraveljavascriptroutesrouting

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dogadogmbh-laroute/health.svg)

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

###  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)

PHPackages © 2026

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