PHPackages                             laravelba/laravel-js-routes - 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. laravelba/laravel-js-routes

Abandoned → [aaronlord/laroute](/?search=aaronlord%2Flaroute)Library[Utility &amp; Helpers](/categories/utility)

laravelba/laravel-js-routes
===========================

Access Laravel routes from your javascript files.

1.0.0(10y ago)218.3k1MITJavaScriptPHP &gt;=5.6.0

Since May 24Pushed 9y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (12)Versions (3)Used By (0)

Laravel Javascript Routes
=========================

[](#laravel-javascript-routes)

[![Travis Badge](https://camo.githubusercontent.com/2fdd0979469a240afdbb33c97b24141d1552078569ca1d7785873dd5a6d4a266/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4c61726176656c42412f6c61726176656c2d6a732d726f757465732e706e67)](http://travis-ci.org/LaravelBA/laravel-js-routes)[![Latest Stable Version](https://camo.githubusercontent.com/af8abb2ed6280afa6c83fb30b7b5790277b8ffaf03c72cb7e2ed82496e9b1f3e/68747470733a2f2f706f7365722e707567782e6f72672f4c61726176656c42412f6c61726176656c2d6a732d726f757465732f762f737461626c652e706e67)](https://packagist.org/packages/LaravelBA/laravel-js-routes)[![Latest Unstable Version](https://camo.githubusercontent.com/973d6fb50567a1954311032d132ca918080ad30fcaf74a2e10fc018165495cb8/68747470733a2f2f706f7365722e707567782e6f72672f4c61726176656c42412f6c61726176656c2d6a732d726f757465732f762f756e737461626c652e706e67)](https://packagist.org/packages/LaravelBA/laravel-js-routes)[![Total Downloads](https://camo.githubusercontent.com/2c32a277e88666a5ee25dd0ddf07125671399bffd544c92e948bce471f1d0cee/68747470733a2f2f706f7365722e707567782e6f72672f4c61726176656c42412f6c61726176656c2d6a732d726f757465732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/LaravelBA/laravel-js-routes)[![License](https://camo.githubusercontent.com/c254281050db690750d307173526c4836322bb9b60d0d71f7dcf0157d0535a1b/68747470733a2f2f706f7365722e707567782e6f72672f4c61726176656c42412f6c61726176656c2d6a732d726f757465732f6c6963656e73652e706e67)](https://packagist.org/packages/LaravelBA/laravel-js-routes)

DEPRECATED
==========

[](#deprecated)

This package is no longer maintained. Please use  or any other alternative you may find!

Why?
----

[](#why)

We love the Laravel routing system and we often use named routes like `route('users.show', ['id' => 1])` to generate `http://domain.tld/users/1`. With the amazing uprising of Javascript frameworks (AngularJS, EmberJS, Backbone, etc.) it's hard to track changes on your routes between the backend and the REST calls from your Javascript. The goal of this library is to expose those named routes to your frontend so you can do: `Router.route('users.show', {id: 1})` and get the same result.

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

[](#installation)

Begin by installing this package through Composer.

```
composer require laravelba/laravel-js-routes
```

To use this package, add its service provider to your `config/app.php` providers array.

```
    'providers' => [
        // ...
        LaravelBA\LaravelJsRoutes\LaravelJsRoutesServiceProvider::class,
    ],
```

Usage
-----

[](#usage)

The ServiceProvider will add a new command `routes:javascript` to your `artisan` commands. By default, this command will generate a `routes.js` file on your `resources/assets/js` folder. This contains all **named** routes in your app. That's it! You're all set to go.

```
$ php artisan routes:javascript
```

> **Lazy Tip** If you use elixir (or any js task manager), set up a watcher that runs this command whenever your php routes change.

Arguments
---------

[](#arguments)

NameDefaultDescription**name***routes.js*Output filenameOptions
-------

[](#options)

NameDefaultDescription**path***resources/assets/js*Where to save the generated filename, relative to the base path. (ie. "public/assets" folder if you don't plan to mix it.)**middleware***null*If you want only some routes to be available on JS, you can use a middleware (like js-routable) to select only those**object***Router*If you want to choose your own global JS object (to avoid collision)**prefix***null*If you want to a path to prefix to all your routesJavascript usage
----------------

[](#javascript-usage)

By default, the command will generate a `routes.js` file on your `resources/assets/js` folder, so you can use elixir:

```
elixir(function(mix){
    mix.scripts([
        'routes.js',
        'app.js'
    ]);
});
```

You may generate the routes file in your public folder instead...

```
php artisan routes:javascript --path public/js
```

...then include it in your views:

```

```

In any case, you'll have a `Routes` object on your global scope.

Examples:

```
// Usage: Router.route(route_name, params)
Router.route('users.show', {id: 1}) // returns http://dommain.tld/users/1

// If you assign parameters that are not present on the URI, they will get appended as a query string:
Router.route('users.show', {id: 1, name: 'John', order: 'asc'}) // returns http://dommain.tld/users/1?name=John&order=asc
```

Contributing
------------

[](#contributing)

This project uses `phpunit` for php testing and `jasmine` for JS testing. Check available grunt tasks in the `Gruntfile.js` file.

Found a bug?
------------

[](#found-a-bug)

Please, let us know! Send a pull request (better) or create an issue. Questions? Ask! We will respond to all issues.

Inspiration
-----------

[](#inspiration)

Although no code was copied, this package is greatly inspired by [FOSJsRoutingBundle](https://github.com/FriendsOfSymfony/FOSJsRoutingBundle) for Symfony.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.3% 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 ~0 days

Total

2

Last Release

3689d ago

Major Versions

0.9.0 → 1.0.02016-05-24

PHP version history (2 changes)0.9.0PHP &gt;=5.4.0

1.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/34c0365f697eb3491eb619d8cad1f38bc68c7b7140842a7492c6a9d8753a07d5?d=identicon)[guiwoda](/maintainers/guiwoda)

---

Top Contributors

[![fedeisas](https://avatars.githubusercontent.com/u/251675?v=4)](https://github.com/fedeisas "fedeisas (57 commits)")[![guiwoda](https://avatars.githubusercontent.com/u/1625545?v=4)](https://github.com/guiwoda "guiwoda (10 commits)")[![zaalbarxx](https://avatars.githubusercontent.com/u/3301242?v=4)](https://github.com/zaalbarxx "zaalbarxx (3 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

laraveljavascriptroutesgenerators

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/laravelba-laravel-js-routes/health.svg)

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M169](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M131](/packages/laravel-mcp)[laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

1.8k8.6M121](/packages/laravel-wayfinder)[laravel/folio

Page based routing for Laravel.

603583.7k31](/packages/laravel-folio)

PHPackages © 2026

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