PHPackages                             tightenco/ziggy - 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. tightenco/ziggy

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

tightenco/ziggy
===============

Use your Laravel named routes in JavaScript.

v2.6.2(2mo ago)4.3k41.6M—1.9%273[4 issues](https://github.com/tighten/ziggy/issues)[3 PRs](https://github.com/tighten/ziggy/pulls)20MITJavaScriptPHP &gt;=8.1CI passing

Since Aug 4Pushed 1mo ago41 watchersCompare

[ Source](https://github.com/tighten/ziggy)[ Packagist](https://packagist.org/packages/tightenco/ziggy)[ Docs](https://github.com/tighten/ziggy)[ RSS](/packages/tightenco-ziggy/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (105)Used By (20)

[![Ziggy - Use your Laravel routes in JavaScript](https://raw.githubusercontent.com/tighten/ziggy/main/ziggy-banner.png)](https://raw.githubusercontent.com/tighten/ziggy/main/ziggy-banner.png)

Ziggy – Use your Laravel routes in JavaScript
=============================================

[](#ziggy--use-your-laravel-routes-in-javascript)

[![GitHub Actions Status](https://camo.githubusercontent.com/a75d1e94aebecab2fe72814ed505d4d4480ba639bbc9ce200d8a59ad5dc8164f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7469676874656e2f7a696767792f746573742e796d6c3f6272616e63683d6d61696e267374796c653d666c6174)](https://github.com/tighten/ziggy/actions?query=workflow:Test+branch:2.x)[![Latest Version on Packagist](https://camo.githubusercontent.com/ac12ad77e838de7eef7b3e79f03b509da09ba4ab3f56af21a5bb2618ad4b91d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7469676874656e636f2f7a696767792e7376673f7374796c653d666c6174)](https://packagist.org/packages/tightenco/ziggy)[![Downloads on Packagist](https://camo.githubusercontent.com/93d96c28d81adb21770f44deeffde23b56cb762399c1ca7f32aab588a2604b88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7469676874656e636f2f7a696767792e7376673f7374796c653d666c6174)](https://packagist.org/packages/tightenco/ziggy)[![Latest Version on NPM](https://camo.githubusercontent.com/9431bdaeab6a582ddcd6f7b5c25aad20345d3eb8f3a3bf2048293062fd8fb9eb/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f7a696767792d6a732e7376673f7374796c653d666c6174)](https://npmjs.com/package/ziggy-js)[![Downloads on NPM](https://camo.githubusercontent.com/4cea29e874a53412e4588ee083320f2a28da4903535db1abc79342ddf5af8fb0/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f64742f7a696767792d6a732e7376673f7374796c653d666c6174)](https://npmjs.com/package/ziggy-js)

Ziggy provides a JavaScript `route()` function that works like Laravel's, making it a breeze to use your named Laravel routes in JavaScript.

- [**Installation**](#installation)
- [**Usage**](#usage)
    - [`route()` function](#route-function)
    - [`Router` class](#router-class)
    - [Route-model binding](#route-model-binding)
    - [TypeScript](#typescript)
- [**JavaScript frameworks**](#javascript-frameworks)
    - [Generating and importing Ziggy's configuration](#generating-and-importing-ziggys-configuration)
    - [Importing the `route()` function](#importing-the-route-function)
    - [Vue](#vue)
    - [React](#react)
    - [SPAs or separate repos](#spas-or-separate-repos)
- [**Filtering Routes**](#filtering-routes)
    - [Including/excluding routes](#includingexcluding-routes)
    - [Filtering with groups](#filtering-with-groups)
- [**Other**](#other)
- [**Contributing**](#contributing)

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

[](#installation)

Install Ziggy in your Laravel app with Composer:

```
composer require tightenco/ziggy
```

Add the `@routes` Blade directive to your main layout (*before* your application's JavaScript), and the `route()` helper function will be available globally!

> By default, the output of the `@routes` Blade directive includes a list of all your application's routes and their parameters. This route list is included in the HTML of the page and can be viewed by end users. To configure which routes are included in this list, or to show and hide different routes on different pages, see [Filtering Routes](#filtering-routes).

Usage
-----

[](#usage)

### `route()` function

[](#route-function)

Ziggy's `route()` function works like [Laravel's `route()` helper](https://laravel.com/docs/helpers#method-route)—you can pass it the name of a route, and the parameters you want to pass to the route, and it will generate a URL.

#### Basic usage

[](#basic-usage)

```
Route::get('posts', fn (Request $request) => /* ... */)->name('posts.index');
```

```
route('posts.index'); // 'https://ziggy.test/posts'
```

#### Parameters

[](#parameters)

```
Route::get('posts/{post}', fn (Post $post) => /* ... */)->name('posts.show');
```

```
route('posts.show', 1);           // 'https://ziggy.test/posts/1'
route('posts.show', [1]);         // 'https://ziggy.test/posts/1'
route('posts.show', { post: 1 }); // 'https://ziggy.test/posts/1'
```

#### Multiple parameters

[](#multiple-parameters)

```
Route::get('venues/{venue}/events/{event}', fn (Venue $venue, Event $event) => /* ... */)
    ->name('venues.events.show');
```

```
route('venues.events.show', [1, 2]);                 // 'https://ziggy.test/venues/1/events/2'
route('venues.events.show', { venue: 1, event: 2 }); // 'https://ziggy.test/venues/1/events/2'
```

#### Query parameters

[](#query-parameters)

Ziggy adds arguments that don't match any named route parameters as query parameters:

```
Route::get('venues/{venue}/events/{event}', fn (Venue $venue, Event $event) => /* ... */)
    ->name('venues.events.show');
```

```
route('venues.events.show', {
    venue: 1,
    event: 2,
    page: 5,
    count: 10,
});
// 'https://ziggy.test/venues/1/events/2?page=5&count=10'
```

If you need to pass a query parameter with the same name as a route parameter, nest it under the special `_query` key:

```
route('venues.events.show', {
    venue: 1,
    event: 2,
    _query: {
        event: 3,
        page: 5,
    },
});
// 'https://ziggy.test/venues/1/events/2?event=3&page=5'
```

Like Laravel, Ziggy automatically encodes boolean query parameters as integers in the query string:

```
route('venues.events.show', {
    venue: 1,
    event: 2,
    _query: {
        draft: false,
        overdue: true,
    },
});
// 'https://ziggy.test/venues/1/events/2?draft=0&overdue=1'
```

#### Default parameter values

[](#default-parameter-values)

Ziggy supports default route parameter values ([Laravel docs](https://laravel.com/docs/urls#default-values)).

```
Route::get('{locale}/posts/{post}', fn (Post $post) => /* ... */)->name('posts.show');
```

```
// app/Http/Middleware/SetLocale.php

URL::defaults(['locale' => $request->user()->locale ?? 'de']);
```

```
route('posts.show', 1); // 'https://ziggy.test/de/posts/1'
```

#### Examples

[](#examples)

HTTP request with `axios`:

```
const post = { id: 1, title: 'Ziggy Stardust' };

return axios.get(route('posts.show', post)).then((response) => response.data);
```

### `Router` class

[](#router-class)

Calling Ziggy's `route()` function with no arguments will return an instance of its JavaScript `Router` class, which has some other useful properties and methods.

#### Check the current route: `route().current()`

[](#check-the-current-route-routecurrent)

```
// Laravel route called 'events.index' with URI '/events'
// Current window URL is https://ziggy.test/events

route().current();               // 'events.index'
route().current('events.index'); // true
route().current('events.*');     // true
route().current('events.show');  // false
```

`route().current()` optionally accepts parameters as its second argument, and will check that their values also match in the current URL:

```
// Laravel route called 'venues.events.show' with URI '/venues/{venue}/events/{event}'
// Current window URL is https://myapp.com/venues/1/events/2?hosts=all

route().current('venues.events.show', { venue: 1 });           // true
route().current('venues.events.show', { venue: 1, event: 2 }); // true
route().current('venues.events.show', { hosts: 'all' });       // true
route().current('venues.events.show', { venue: 6 });           // false
```

#### Check if a route exists: `route().has()`

[](#check-if-a-route-exists-routehas)

```
// Laravel app has only one named route, 'home'

route().has('home');   // true
route().has('orders'); // false
```

#### Retrieve the current route params: `route().params`

[](#retrieve-the-current-route-params-routeparams)

```
// Laravel route called 'venues.events.show' with URI '/venues/{venue}/events/{event}'
// Current window URL is https://myapp.com/venues/1/events/2?hosts=all

route().params; // { venue: '1', event: '2', hosts: 'all' }
```

> Note: parameter values retrieved with `route().params` will always be returned as strings.

### Route-model binding

[](#route-model-binding)

Ziggy supports Laravel's [route-model binding](https://laravel.com/docs/routing#route-model-binding), and can even recognize custom route key names. If you pass `route()` a JavaScript object as a route parameter, Ziggy will use the registered route-model binding keys for that route to find the correct parameter value inside the object. If no route-model binding keys are explicitly registered for a parameter, Ziggy will use the object's `id` key.

```
// app/Models/Post.php

class Post extends Model
{
    public function getRouteKeyName()
    {
        return 'slug';
    }
}
```

```
Route::get('blog/{post}', function (Post $post) {
    return view('posts.show', ['post' => $post]);
})->name('posts.show');
```

```
const post = {
    id: 3,
    title: 'Introducing Ziggy v1',
    slug: 'introducing-ziggy-v1',
    date: '2020-10-23T20:59:24.359278Z',
};

// Ziggy knows that this route uses the 'slug' route-model binding key:

route('posts.show', post); // 'https://ziggy.test/blog/introducing-ziggy-v1'
```

Ziggy also supports [custom keys](https://laravel.com/docs/routing#customizing-the-key) for scoped bindings declared directly in a route definition:

```
Route::get('authors/{author}/photos/{photo:uuid}', fn (Author $author, Photo $photo) => /* ... */)
    ->name('authors.photos.show');
```

```
const photo = {
    uuid: '714b19e8-ac5e-4dab-99ba-34dc6fdd24a5',
    filename: 'sunset.jpg',
}

route('authors.photos.show', [{ id: 1, name: 'Ansel' }, photo]);
// 'https://ziggy.test/authors/1/photos/714b19e8-ac5e-4dab-99ba-34dc6fdd24a5'
```

### TypeScript

[](#typescript)

Ziggy includes TypeScript type definitions, and an Artisan command that can generate additional type definitions to enable route name and parameter autocompletion.

To generate route types, run the `ziggy:generate` command with the `--types` or `--types-only` option:

```
php artisan ziggy:generate --types
```

To make your IDE aware that Ziggy's `route()` helper is available globally, and to type it correctly, add a declaration like this in a `.d.ts` file somewhere in your project:

```
import { route as routeFn } from 'ziggy-js';

declare global {
    var route: typeof routeFn;
}
```

If you don't have Ziggy's NPM package installed, add the following to your `jsconfig.json` or `tsconfig.json` to load Ziggy's types from your vendor directory:

```
{
    "compilerOptions": {
        "paths": {
            "ziggy-js": ["./vendor/tightenco/ziggy"]
        }
    }
}
```

#### Strict route name type checking

[](#strict-route-name-type-checking)

By default, even when you generate type definitions to enable better autocompletion, Ziggy still allows passing any string to `route()`. You can optionally enable strict type checking of route names, so that calling `route()` with a route name Ziggy doensn't recognizes triggers a type error. To do so, extend Ziggy's `TypeConfig` interface and set `strictRouteNames` to `true`:

```
declare module 'ziggy-js' {
  interface TypeConfig {
    strictRouteNames: true
  }
}
```

Place this declaration in a `.d.ts` type definition file somewhere in your project. Depending on your setup, you may need to add an `export {};` statement to the end of file so TypeScript can pick it up.

JavaScript frameworks
---------------------

[](#javascript-frameworks)

Note

Many applications don't need the additional setup described here—the `@routes` Blade directive makes Ziggy's `route()` function and config available globally, including within bundled JavaScript files.

If you are not using the `@routes` Blade directive, you can import Ziggy's `route()` function and configuration directly into JavaScript/TypeScript files.

### Generating and importing Ziggy's configuration

[](#generating-and-importing-ziggys-configuration)

Ziggy provides an Artisan command to output its config and routes to a file:

```
php artisan ziggy:generate
```

This command places your configuration in `resources/js/ziggy.js` by default, but you can customize this path by passing an argument to the Artisan command or setting the `ziggy.output.path` config value.

The file `ziggy:generate` creates looks something like this:

```
// resources/js/ziggy.js

const Ziggy = {
    url: 'https://ziggy.test',
    port: null,
    routes: {
        home: {
            uri: '/',
            methods: [ 'GET', 'HEAD'],
            domain: null,
        },
        login: {
            uri: 'login',
            methods: ['GET', 'HEAD'],
            domain: null,
        },
    },
};

export { Ziggy };
```

### Importing the `route()` function

[](#importing-the-route-function)

You can import Ziggy like any other JavaScript library. Without the `@routes` Blade directive Ziggy's config is not available globally, so it must be passed to the `route()` function manually:

```
import { route } from '../../vendor/tightenco/ziggy';
import { Ziggy } from './ziggy.js';

route('home', undefined, undefined, Ziggy);
```

To simplify importing the `route()` function, you can create an alias to the vendor path:

```
// vite.config.js

export default defineConfig({
    resolve: {
        alias: {
            'ziggy-js': path.resolve('vendor/tightenco/ziggy'),
        },
    },
});
```

Now your imports can be shortened to:

```
import { route } from 'ziggy-js';
```

### Vue

[](#vue)

Ziggy includes a Vue plugin to make it easy to use the `route()` helper throughout your Vue app:

```
import { createApp } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import App from './App.vue';

createApp(App).use(ZiggyVue);
```

Now you can use the `route()` function anywhere in your Vue components and templates:

```
Home
```

With `` in Vue 3 you can use `inject` to make the `route()` function available in your component script:

```

import { inject } from 'vue';

const route = inject('route');

```

If you are not using the `@routes` Blade directive, import Ziggy's configuration too and pass it to `.use()`:

```
import { createApp } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { Ziggy } from './ziggy.js';
import App from './App.vue';

createApp(App).use(ZiggyVue, Ziggy);
```

If you're using TypeScript, you may need to add the following declaration to a `.d.ts` file in your project to avoid type errors when using the `route()` function in your Vue component templates:

```
declare module 'vue' {
    interface ComponentCustomProperties {
        route: typeof routeFn;
    }
}
```

### React

[](#react)

Ziggy includes a `useRoute()` hook to make it easy to use the `route()` helper in your React app:

```
import React from 'react';
import { useRoute } from 'ziggy-js';

export default function PostsLink() {
    const route = useRoute();

    return Posts;
}
```

If you are not using the `@routes` Blade directive, import Ziggy's configuration too and pass it to `useRoute()`:

```
import React from 'react';
import { useRoute } from 'ziggy-js';
import { Ziggy } from './ziggy.js';

export default function PostsLink() {
    const route = useRoute(Ziggy);

    return Posts;
}
```

You can also make the `Ziggy` config object available globally, so you can call `useRoute()` without passing Ziggy's configuration to it every time:

```
// app.js
import { Ziggy } from './ziggy.js';
globalThis.Ziggy = Ziggy;
```

### SPAs or separate repos

[](#spas-or-separate-repos)

Ziggy's `route()` function is available as an NPM package, for use in JavaScript projects managed separately from their Laravel backend (i.e. without Composer or a `vendor` directory). You can install the NPM package with `npm install ziggy-js`.

To make your routes available on the frontend for this function to use, you can either run `php artisan ziggy:generate` and add the generated config file to your frontend project, or you can return Ziggy's config as JSON from an endpoint in your Laravel API (see [Retrieving Ziggy's config from an API endpoint](#retrieving-ziggys-config-from-an-api-endpoint) below for an example of how to set this up).

Filtering Routes
----------------

[](#filtering-routes)

Ziggy supports filtering the list of routes it outputs, which is useful if you have certain routes that you don't want to be included and visible in your HTML source.

Important

Hiding routes from Ziggy's output is not a replacement for thorough authentication and authorization. Routes that should not be accessibly publicly should be protected by authentication whether they're filtered out of Ziggy's output or not.

### Including/excluding routes

[](#includingexcluding-routes)

To set up route filtering, create a config file in your Laravel app at `config/ziggy.php` and add **either** an `only` or `except` key containing an array of route name patterns.

> Note: You have to choose one or the other. Setting both `only` and `except` will disable filtering altogether and return all named routes.

```
// config/ziggy.php

return [
    'only' => ['home', 'posts.index', 'posts.show'],
];
```

You can use asterisks as wildcards in route filters. In the example below, `admin.*` will exclude routes named `admin.login`, `admin.register`, etc.:

```
// config/ziggy.php

return [
    'except' => ['_debugbar.*', 'horizon.*', 'admin.*'],
];
```

### Filtering with groups

[](#filtering-with-groups)

You can also define groups of routes that you want make available in different places in your app, using a `groups` key in your config file:

```
// config/ziggy.php

return [
    'groups' => [
        'admin' => ['admin.*', 'users.*'],
        'author' => ['posts.*'],
    ],
];
```

Then, you can expose a specific group by passing the group name into the `@routes` Blade directive:

```
{{-- authors.blade.php --}}

@routes('author')
```

To expose multiple groups you can pass an array of group names:

```
{{-- admin.blade.php --}}

@routes(['admin', 'author'])
```

> Note: Passing group names to the `@routes` directive will always take precedence over your other `only` or `except` settings.

Other
-----

[](#other)

### TLS/SSL termination and trusted proxies

[](#tlsssl-termination-and-trusted-proxies)

If your application is using [TLS/SSL termination](https://en.wikipedia.org/wiki/TLS_termination_proxy) or is behind a load balancer or proxy, or if it's hosted on a service that is, Ziggy may generate URLs with a scheme of `http` instead of `https`, even if your app URL uses `https`. To fix this, set up your Laravel app's trusted proxies according to the documentation on [Configuring Trusted Proxies](https://laravel.com/docs/requests#configuring-trusted-proxies).

### Using `@routes` with a Content Security Policy

[](#using-routes-with-a-content-security-policy)

A [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) (CSP) may block inline scripts, including those output by Ziggy's `@routes` Blade directive. If you have a CSP and are using a nonce to flag safe inline scripts, you can pass the nonce to the `@routes` directive and it will be added to Ziggy's script tag:

```
@routes(nonce: 'your-nonce-here')
```

Alternatively, you can configure Ziggy to output your routes as plain JSON, rather than JavaScript, so that the output is ignored by the CSP. Note that if you use this option you will need to load Ziggy's JavaScript `route()` function yourself, by configuring the Vue plugin or React hook or importing the JavaScript manually.

```
@routes(json: true)
```

### Disabling the `route()` helper

[](#disabling-the-route-helper)

If you only want to use the `@routes` directive to make Ziggy's configuration available in JavaScript, but don't need the `route()` helper function, set the `ziggy.skip-route-function` config to `true`.

### Retrieving Ziggy's config from an API endpoint

[](#retrieving-ziggys-config-from-an-api-endpoint)

If you need to retrieve Ziggy's config from your Laravel backend over the network, you can create a route that looks something like this:

```
// routes/api.php

use Tighten\Ziggy\Ziggy;

Route::get('ziggy', fn () => response()->json(new Ziggy));
```

### Re-generating the routes file when your app routes change

[](#re-generating-the-routes-file-when-your-app-routes-change)

If you are generating your Ziggy config as a file by running `php artisan ziggy:generate`, you may want to re-run that command when your app's route files change. The example below is a Laravel Mix plugin, but similar functionality could be achieved without Mix. Huge thanks to [Nuno Rodrigues](https://github.com/nacr) for [the idea and a sample implementation](https://github.com/tighten/ziggy/issues/321#issuecomment-689150082). See [\#655](https://github.com/tighten/ziggy/pull/655/files#diff-4aeb78f813e14842fcf95bdace9ced23b8a6eed60b23c165eaa52e8db2f97b61) or [vite-plugin-ziggy](https://github.com/aniftyco/vite-plugin-ziggy) for Vite examples.

Laravel Mix plugin example```
const mix = require('laravel-mix');
const { exec } = require('child_process');

mix.extend('ziggy', new class {
    register(config = {}) {
        this.watch = config.watch ?? ['routes/**/*.php'];
        this.path = config.path ?? '';
        this.enabled = config.enabled ?? !Mix.inProduction();
    }

    boot() {
        if (!this.enabled) return;

        const command = () => exec(
            `php artisan ziggy:generate ${this.path}`,
            (error, stdout, stderr) => console.log(stdout)
        );

        command();

        if (Mix.isWatching() && this.watch) {
            ((require('chokidar')).watch(this.watch))
                .on('change', (path) => {
                    console.log(`${path} changed...`);
                    command();
                });
        };
    }
}());

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [])
    .ziggy();
```

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

[](#contributing)

To get started contributing to Ziggy, check out [the contribution guide](CONTRIBUTING.md).

Credits
-------

[](#credits)

- [Daniel Coulbourne](https://twitter.com/DCoulbourne)
- [Jake Bathman](https://twitter.com/jakebathman)
- [Matt Stauffer](https://twitter.com/stauffermatt)
- [Jacob Baker-Kretzmar](https://twitter.com/bakerkretzmar)
- [All contributors](https://github.com/tighten/ziggy/contributors)

Thanks to [Caleb Porzio](http://twitter.com/calebporzio), [Adam Wathan](http://twitter.com/adamwathan), and [Jeffrey Way](http://twitter.com/jeffrey_way) for help solidifying the idea.

Security
--------

[](#security)

Please review our [security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

Ziggy is open-source software released under the MIT license. See [LICENSE](LICENSE) for more information.

###  Health Score

81

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity80

Widely adopted with strong download metrics

Community56

Growing community involvement

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 68.1% 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 ~33 days

Recently: every ~78 days

Total

96

Last Release

53d ago

Major Versions

0.9.x-dev → v1.0.0-beta.12020-10-24

v1.8.1 → v2.0.0-beta.12023-11-02

v1.8.2 → v2.0.02024-02-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151829?v=4)[Matt Stauffer](/maintainers/mattstauffer)[@mattstauffer](https://github.com/mattstauffer)

![](https://www.gravatar.com/avatar/006af051ccd573c15c7b08091b4a1a1a2c12aab20aa52733f2cea484c5c464db?d=identicon)[coulbourne](/maintainers/coulbourne)

---

Top Contributors

[![bakerkretzmar](https://avatars.githubusercontent.com/u/18192441?v=4)](https://github.com/bakerkretzmar "bakerkretzmar (651 commits)")[![DanielCoulbourne](https://avatars.githubusercontent.com/u/429010?v=4)](https://github.com/DanielCoulbourne "DanielCoulbourne (111 commits)")[![mattstauffer](https://avatars.githubusercontent.com/u/151829?v=4)](https://github.com/mattstauffer "mattstauffer (35 commits)")[![jakebathman](https://avatars.githubusercontent.com/u/43112?v=4)](https://github.com/jakebathman "jakebathman (34 commits)")[![ankurk91](https://avatars.githubusercontent.com/u/6111524?v=4)](https://github.com/ankurk91 "ankurk91 (22 commits)")[![shuvroroy](https://avatars.githubusercontent.com/u/21066418?v=4)](https://github.com/shuvroroy "shuvroroy (7 commits)")[![alexmccabe](https://avatars.githubusercontent.com/u/2529110?v=4)](https://github.com/alexmccabe "alexmccabe (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![pataar](https://avatars.githubusercontent.com/u/3403851?v=4)](https://github.com/pataar "pataar (6 commits)")[![gms8994](https://avatars.githubusercontent.com/u/50712?v=4)](https://github.com/gms8994 "gms8994 (6 commits)")[![benallfree](https://avatars.githubusercontent.com/u/1068356?v=4)](https://github.com/benallfree "benallfree (6 commits)")[![nanaya](https://avatars.githubusercontent.com/u/276295?v=4)](https://github.com/nanaya "nanaya (5 commits)")[![jaulz](https://avatars.githubusercontent.com/u/5358638?v=4)](https://github.com/jaulz "jaulz (5 commits)")[![rodrigopedra](https://avatars.githubusercontent.com/u/5470108?v=4)](https://github.com/rodrigopedra "rodrigopedra (4 commits)")[![driftingly](https://avatars.githubusercontent.com/u/194221?v=4)](https://github.com/driftingly "driftingly (4 commits)")[![Tofandel](https://avatars.githubusercontent.com/u/6115458?v=4)](https://github.com/Tofandel "Tofandel (4 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (4 commits)")[![victorlap](https://avatars.githubusercontent.com/u/1645632?v=4)](https://github.com/victorlap "victorlap (4 commits)")[![YeeJiaWei](https://avatars.githubusercontent.com/u/21292986?v=4)](https://github.com/YeeJiaWei "YeeJiaWei (3 commits)")[![emielmolenaar](https://avatars.githubusercontent.com/u/2470795?v=4)](https://github.com/emielmolenaar "emielmolenaar (3 commits)")

---

Tags

javascriptlaravelroutesziggylaraveljavascriptroutesZiggy

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/tightenco-ziggy/health.svg)

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

###  Alternatives

[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[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)
