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

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

cjpgdk/laravel-js-routes
========================

Laravel routes loaded into javascript

v0.2.0(6y ago)010MITPHPPHP &gt;=5.6

Since Mar 7Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (5)Used By (0)

laravel-js-routes.
------------------

[](#laravel-js-routes)

Just an other way of loading Laravel routes into Javascript. Nothing special!

Install
-------

[](#install)

`composer require cjpgdk/laravel-js-routes`

*Publish the JS files, you most likely want to change them!*

`php artisan vendor:publish --provider="Cjpgdk\Laravel\JsRoutes\ServiceProvider" --tag=js-routes-js`

*Publish the View files, Unless you just use your own in config `'bind_to_view' => ['js-routes::header']`*

`php artisan vendor:publish --provider="Cjpgdk\Laravel\JsRoutes\ServiceProvider" --tag=js-routes-js`

**NOTE** The js-routes service provider, is auto loaded in Laravel, you may disable this by adding the following code to your `composer.json`, if you need to load the package after other dependencies.

```
{
    "extra": {
        "laravel": {
            "dont-discover": [
                "Cjpgdk\\Laravel\\JsRoutes\\ServiceProvider"
            ]
        }
    }
}
```

#### After install

[](#after-install)

load the header view `@include('js-routes::header')`, this will append all loaded routes into `window.jsLaravelRoutes`.

*load js in `app.js`*

```
/* plain JavaScript */
import JsRouter from "./js-routes/class.JsRouter";
window.JsRouter = new JsRouter(window.jsLaravelRoutes);
/* See the file for methods. */

// the VueJs file loads the file class.JsRouter,
// so no need to load both, if only using Vue.

/* VueJS */
window.Vue = require('vue');
import VueJsRouter from "./js-routes/vue.JsRouter";
Vue.use(VueJsRouter, {
    /* all routes or value of config: `js_routes_var` */
    routes: window.jsLaravelRoutes
});
/*
 * Vue.JsRouter : class instance, See the file for methods.
 *
 * Vue.navigateTo('route-name', {
 *     // variables used in the domain, optional variables goes here as well.
 *     vars: {
 *         var: 'value',
 *         var2: 'value'
 *     },
 *     // variables used in the domain, if needed, then they are required.
 *     domain: {
 *         var: 'value',
 *         var2: 'value'
 *     }
 * });
 *
 *  OR in components.
 *
 *  this.$navigateTo('route-name', {...});
 *
 */
```

#### Config

[](#config)

*js-routes.php* namespace `js-routes`

```
return [
    /*
    |--------------------------------------------------------------------------
    | View to bind the JsLaravelRoutes to.
    |--------------------------------------------------------------------------
    |
    | Set this value to the name of the view that
    | you want to prepend the JavaScript to.
    | This can be a single view, or an array of views.
    | Default: header
    | Example: ['footer', 'header'] or ['footer']
    | Note:    if using an array make sure the views
    |          are not loaded on the same page.
    | Default: header
    |
    */
    'bind_to_view' => ['js-routes::header'],

    /*
    |--------------------------------------------------------------------------
    | Routers Namespace
    |--------------------------------------------------------------------------
    |
    | It's recommended that you change this to something ... anything.
    |
    | Default: window.jsLaravelRoutes
    |
    */
    'js_routes_var' => 'window.jsLaravelRoutes',

    /*
    |--------------------------------------------------------------------------
    | Router macros names.
    |--------------------------------------------------------------------------
    |
    | Only edit if the names are causing a conflict.
    |
    | Format: Internal-name => Alias.
    |
    */
    'macros' => [
        /**
         * $route->compileAndGetRoute();
         * Returns the compiled route. @see \Symfony\Component\Routing\CompiledRoute
         */
        'compileAndGetRoute' => 'compileAndGetRoute',
        /**
         * $route->getOptionalParameters();
         * Returns the optional route parameters as an array.
         *
         * $optional = [ 'name' => null, ...];
         */
        'getOptionalParameters' => 'getOptionalParameters',
    ]
];
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2256d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24781a7cdf308d940e5900c79eb77ecc6bfc4b2bbde02d5483626db97dab785d?d=identicon)[cjpgdk](/maintainers/cjpgdk)

---

Top Contributors

[![cjpgdk](https://avatars.githubusercontent.com/u/28824225?v=4)](https://github.com/cjpgdk "cjpgdk (19 commits)")

---

Tags

laraveljavascriptroutes

### Embed Badge

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

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

###  Alternatives

[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[te7a-houdini/laroute

Access Laravels URL/Route helper functions, from JavaScript.

33512.1k](/packages/te7a-houdini-laroute)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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