PHPackages                             herolabid/pathify - 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. [API Development](/categories/api)
4. /
5. herolabid/pathify

ActiveLibrary[API Development](/categories/api)

herolabid/pathify
=================

Use your Laravel routes in JavaScript - A powerful alternative to Ziggy

v1.4.2(3mo ago)09MITPHPPHP ^8.2

Since Jan 23Pushed 3mo agoCompare

[ Source](https://github.com/herolabid/Pathify)[ Packagist](https://packagist.org/packages/herolabid/pathify)[ RSS](/packages/herolabid-pathify/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (12)Used By (0)

Pathify
=======

[](#pathify)

 **Use your Laravel routes in JavaScript — A powerful alternative to Ziggy**

 [![Latest Version](https://camo.githubusercontent.com/5c6e62a2bb238bdc275edbc590b42f8a74ae0d7a610d7eaf0bd1b79401948d19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6865726f6c616269642f706174686966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/herolabid/pathify) [![Total Downloads](https://camo.githubusercontent.com/143eafaf771a84a1f0aa5bf6d9091033aa98a5052e95a4439c4abcd8a86eba53/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6865726f6c616269642f706174686966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/herolabid/pathify) [![PHP Version](https://camo.githubusercontent.com/1f5e4dc0f8246ae871d1f29f0be205bceff92f7bc091a7be73625a65f6c2b261/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6865726f6c616269642f706174686966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/herolabid/pathify) [![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Buy Me Coffee](https://camo.githubusercontent.com/f319d3e6165409e74cf11df3c01b7f0dd56b48d3f3bd2ddb2fa4ee60296efa17/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532304d65253230436f666665652d6666646430303f7374796c653d666c61742d737175617265266c6f676f3d6275792d6d652d612d636f66666565266c6f676f436f6c6f723d626c61636b)](https://buymeacoffee.com/herostack)

 [Installation](#installation) • [Usage](#usage) • [Features](#features) • [Frameworks](#frameworks) • [API](#api)

Why Pathify?
------------

[](#why-pathify)

Pathify brings your Laravel routes to JavaScript with extras that Ziggy doesn't have:

```
┌─────────────────────────────────┬─────────┬─────────┐
│ Feature                         │  Ziggy  │ Pathify │
├─────────────────────────────────┼─────────┼─────────┤
│ Route generation & parameters   │    ✓    │    ✓    │
│ TypeScript support              │    ✓    │    ✓    │
├─────────────────────────────────┼─────────┼─────────┤
│ Permission checking (can())     │         │    ✓    │
│ Minimal mode (reduce payload)   │         │    ✓    │
│ Route caching                   │         │    ✓    │
│ Intelligent prefetching         │         │    ✓    │
│ Auto breadcrumbs                │         │    ✓    │
│ Navigation builder              │         │    ✓    │
│ Multi-language URLs (i18n)      │         │    ✓    │
│ Auto .gitignore management      │         │    ✓    │
└─────────────────────────────────┴─────────┴─────────┘

```

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

[](#installation)

```
# Install via Composer
composer require herolabid/pathify

# Publish config (optional)
php artisan vendor:publish --tag=pathify-config

# Publish JavaScript files (for Vue/React/TypeScript projects)
php artisan vendor:publish --tag=pathify-js
```

This will copy JS/TS files to `resources/js/vendor/pathify/`.

Usage
-----

[](#usage)

### Blade (Simplest)

[](#blade-simplest)

Just add the directive — no imports needed:

```

    @pathify
    @vite(['resources/js/app.js'])

```

```
// Available globally via window.Pathify
route('posts.index')              // → /posts
route('posts.show', { post: 1 })  // → /posts/1
```

### With Vue/React (Import Method)

[](#with-vuereact-import-method)

After publishing JS files:

```
// Vue
import { useRoute } from '@/vendor/pathify/vue'
const route = useRoute()

// React
import { useRoute } from '@/vendor/pathify/react'
const route = useRoute()

// Vanilla JS
import { route } from '@/vendor/pathify/route'
```

### Inertia.js

[](#inertiajs)

```
import { setupPathifyFromPage, createPathifyListener } from '@/vendor/pathify/inertia'
import { router } from '@inertiajs/vue3' // or @inertiajs/react

createInertiaApp({
    setup({ el, App, props, plugin }) {
        // Initialize BEFORE mounting
        setupPathifyFromPage(props.initialPage)

        // Keep in sync during navigation
        router.on('navigate', createPathifyListener())

        // Mount app...
    },
})
```

### Basic Examples

[](#basic-examples)

```
route('posts.index')                            // → /posts
route('posts.show', { post: 1 })                // → /posts/1
route('posts.show', [1])                        // → /posts/1 (positional)
route('posts.index', { page: 2, sort: 'desc' }) // → /posts?page=2&sort=desc

route.current()                                 // → 'posts.show'
route.current('posts.*')                        // → true
route.has('posts.index')                        // → true
route.params                                    // → { post: '1' }
```

Features
--------

[](#features)

### Minimal Mode (NEW in v1.4.0)

[](#minimal-mode-new-in-v140)

Reduce payload by sending only routes relevant to current page:

```
// config/pathify.php
'minimal' => [
    'enabled' => true,
    'include_current' => true,   // users.show includes users.*
    'include_common' => true,
    'common_routes' => ['home', 'login', 'logout', 'dashboard'],
    'always_include' => [],
],
```

Or via Blade directive:

```
{{-- Auto minimal (based on current route) --}}
@pathifyMinimal

{{-- Manual patterns --}}
@pathify(['users.*', 'roles.*', 'dashboard'])
```

**Result:** If on `users.edit`, only sends ~10 routes instead of 50+!

### Permission Checking

[](#permission-checking)

```
route.can('admin.dashboard')    // → false (requires auth)
route.can('posts.create')       // → false (requires permission)
```

```
// Laravel route with permission
Route::middleware(['auth', 'can:create-posts'])->group(function () {
    Route::get('/posts/create', [PostController::class, 'create'])->name('posts.create');
});
```

```
New Post
```

### Route Filtering

[](#route-filtering)

```
// config/pathify.php
'only' => ['dashboard', 'users.*', 'roles.*'],
// atau
'except' => ['admin.*', 'api.*', '_debugbar.*'],
```

### Route Groups

[](#route-groups)

```
// config/pathify.php
'groups' => [
    'public' => ['home', 'login', 'register'],
    'admin' => ['users.*', 'roles.*'],
],
```

```
@pathify('admin')  {{-- Only admin routes --}}
```

### Breadcrumbs

[](#breadcrumbs)

```
route.breadcrumbs()
// → [
//   { name: 'home', label: 'Home', url: '/' },
//   { name: 'posts.index', label: 'Posts', url: '/posts' },
//   { name: 'posts.show', label: 'Show', url: '/posts/1' }
// ]
```

### Navigation Builder

[](#navigation-builder)

```
// config/pathify.php
'navigation' => [
    'main' => [
        ['route' => 'home', 'label' => 'Home'],
        ['route' => 'dashboard', 'label' => 'Dashboard', 'auth' => true],
        ['label' => 'Admin', 'permission' => 'admin', 'children' => [
            ['route' => 'admin.users', 'label' => 'Users'],
        ]],
    ],
],
```

```
route.navigation('main') // Auto-filtered by user permissions
```

### Localization

[](#localization)

```
// config/pathify.php
'localization' => [
    'enabled' => true,
    'locales' => ['en', 'id', 'es'],
    'default' => 'en',
],
```

```
route('posts.index', { _locale: 'id' })  // → /id/posts
route.t('posts.index', {}, 'es')         // → /es/posts
```

### Prefetching

[](#prefetching)

```
// config/pathify.php
'prefetch' => [
    'enabled' => true,
    'strategy' => 'hover', // 'hover', 'viewport', 'idle'
],
```

### Caching

[](#caching)

```
// config/pathify.php
'cache' => ['enabled' => env('PATHIFY_CACHE', false), 'ttl' => 3600],
```

```
php artisan pathify:clear
```

Frameworks
----------

[](#frameworks)

### Vue

[](#vue)

```
import { createApp } from 'vue'
import { PathifyVue } from '@/vendor/pathify/vue'

createApp(App).use(PathifyVue).mount('#app')
```

```

import { useRoute } from '@/vendor/pathify/vue'
const route = useRoute()

    Home
    Viewing posts

```

### React

[](#react)

```
import { useRoute } from '@/vendor/pathify/react'

function Nav() {
    const route = useRoute()
    return Home
}
```

### Inertia (Vue/React)

[](#inertia-vuereact)

```
import { setupPathifyFromPage, createPathifyListener } from '@/vendor/pathify/inertia'
import { router } from '@inertiajs/vue3'

createInertiaApp({
    setup({ el, App, props, plugin }) {
        setupPathifyFromPage(props.initialPage)
        router.on('navigate', createPathifyListener())
        // ...
    },
})
```

TypeScript
----------

[](#typescript)

Generate type definitions:

```
php artisan pathify:types
```

```
route('posts.show', { post: 1 })  // ✓ OK
route('posts.show', {})           // ✗ Error: missing 'post'
```

API
---

[](#api)

### JavaScript

[](#javascript)

```
route(name, params?, absolute?)       // Generate URL
route.current()                       // Get current route name
route.current(name, params?)          // Check if matches
route.is(name, params?)               // Alias for current()
route.has(name)                       // Check existence (supports wildcard)
route.can(name)                       // Check permission
route.params                          // Current route parameters
route.url                             // Base URL
route.breadcrumbs(name?, params?)     // Get breadcrumbs
route.navigation(name)                // Get nav items
route.t(name, params?, locale?)       // Localized URL
```

### Blade Directives

[](#blade-directives)

```
@pathify                      {{-- All routes --}}
@pathify('admin')             {{-- Group mode --}}
@pathify(['users.*'])         {{-- Minimal mode with patterns --}}
@pathifyMinimal               {{-- Auto minimal mode --}}
@pathifyMinimal(['users.*'])  {{-- Manual minimal mode --}}
@pathifyConfig                {{-- Raw JSON config --}}
```

### Artisan Commands

[](#artisan-commands)

```
php artisan pathify:generate          # Generate JS config file
php artisan pathify:generate --types  # With TypeScript definitions
php artisan pathify:types             # TypeScript definitions only
php artisan pathify:clear             # Clear route cache
```

Generated files are auto-added to `.gitignore`.

Troubleshooting
---------------

[](#troubleshooting)

ProblemSolution`Pathify config not found`Add `@pathify` directive or call `setupPathifyFromPage()`Routes not appearingAdd name: `->name('posts.index')`, check `except` configTypeScript errorsRun `php artisan pathify:types`Inertia not updatingAdd `router.on('navigate', createPathifyListener())`Permissions not workingSet `include_permissions: true` in config
Support
-------

[](#support)

If you find this package helpful, consider buying me a coffee:

[![Buy Me Coffee](https://camo.githubusercontent.com/ca945a280f3a14cb163086e47d4ee10ce0f2a03e5661def611ba6d7038ed3639/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532304d65253230436f666665652d6666646430303f7374796c653d666f722d7468652d6261646765266c6f676f3d6275792d6d652d612d636f66666565266c6f676f436f6c6f723d626c61636b)](https://buymeacoffee.com/herostack)

License
-------

[](#license)

MIT - Built by [Herolab ID](https://herolab.id)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance78

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

11

Last Release

115d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc01642f81607ec82e4239c7974f69daa17ee38d152bce69580c8628a70e1057?d=identicon)[Irfan Hukama Arsyad](/maintainers/Irfan%20Hukama%20Arsyad)

---

Top Contributors

[![IrfanArsyad](https://avatars.githubusercontent.com/u/4258537?v=4)](https://github.com/IrfanArsyad "IrfanArsyad (13 commits)")

---

Tags

laraveljavascriptroutestypescriptreactvueziggy-alternative

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/herolabid-pathify/health.svg)

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

###  Alternatives

[laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

1.7k4.1M69](/packages/laravel-wayfinder)[kiwilan/typescriptable-laravel

PHP package for Laravel to type Eloquent models, routes, Spatie Settings with autogenerated TypeScript. If you want to use some helpers with Inertia, you can install associated NPM package.

3920.9k](/packages/kiwilan-typescriptable-laravel)[infyomlabs/routes-explorer

Laravel Routes Explorer

3925.6k](/packages/infyomlabs-routes-explorer)[carbon/pipeline

Ultra-fast build stack for Neos CMS based on esbuild and PostCSS

1725.5k1](/packages/carbon-pipeline)[okami101/laravel-admin

Admin panel generator for Laravel 8 and based on Vuetify Admin, a separate SPA admin framework running on top of REST APIs.

382.1k](/packages/okami101-laravel-admin)

PHPackages © 2026

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