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

ActiveLibrary

codiant/laravel-js-routes
=========================

Create Laravel routes for JS files

035PHP

Since Jun 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mahendrgurjar/laravel-js-routes)[ Packagist](https://packagist.org/packages/codiant/laravel-js-routes)[ RSS](/packages/codiant-laravel-js-routes/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel JS routes
=================

[](#laravel-js-routes)

Command for use Laravel routes in JS Files. With this package you can use laravel routes with laravel mix js.

Usage:
------

[](#usage)

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

Execute artisan command

```
php artisan route:js
```

Add variable in header layout file

```
var APP_PATH = "{{ url('/') }}";
```

Add resource to webpack.mix.js:

```
mix.js("resources/js/routes.js", "public/js/routes.js");

And run below command.
npm run develoment
npm run prod
npm run watch
```

Add js file in your footer links file

```

```

Important Notes
---------------

[](#important-notes)

```
When you update your route file don't forgot to run below commands.
php artisan route:js
npm run (prod, develoment, watch)
```

Now you have the `route` function. First parameter of route function is the route name (same as in laravel). Second is an array of parameters or an object of parameters. Third is if you want to use absolute paths, by default true.

Example Uses
------------

[](#example-uses)

```
In laravel route file.
Route::post('/user', /*......*/)->name('user');

In js file
route('user');

Use with parameters
Route::post('/user/{id}', /*......*/)->name('user');

In js file
route('user', [1]);
route('user', {1});

Use parameter with name
Route::post('/user/{user_id}/post/{post_id}', /*......*/)->name('user');

In js file
route('user', [1, 2]);
route('user', {1, 2});
route('user', {'user_id': 1, 'post_id': 2});
```

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

[](#contributing)

Pull requests and issues are welcome.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/074b299618b43ae6a89f7fb2ef7f5985dff5c9b15c58f8adc404c4e7e1e8fd1f?d=identicon)[mgurjar](/maintainers/mgurjar)

---

Top Contributors

[![mahendrgurjar](https://avatars.githubusercontent.com/u/66988706?v=4)](https://github.com/mahendrgurjar "mahendrgurjar (8 commits)")

### Embed Badge

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

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

PHPackages © 2026

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