Download the PHP package laravel/wayfinder without Composer

On this page you can find all versions of the php package laravel/wayfinder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wayfinder

Introduction

Laravel Wayfinder bridges your Laravel backend and TypeScript frontend with zero friction. It automatically generates fully-typed, importable TypeScript functions for your controllers and routes — so you can call your Laravel endpoints directly in your client code just like any other function. No more hardcoding URLs, guessing route parameters, or syncing backend changes manually.

[!IMPORTANT] Wayfinder is currently in Beta, the API is subject to change prior to the v1.0.0 release. All notable changes will be documented in the changelog.

Installation

To get started, install Wayfinder via the Composer package manager:

We also recommend installing and configuring vite-plugin-run to ensure that your routes are generated during Vite's build step and also whenever your files change while running the Vite's dev server.

First, install the plugin via NPM:

Then, update your application's vite.config.js file to watch for changes to your application's routes and controllers:

Generating TypeScript Definitions

The wayfinder:generate command can be used to generate TypeScript definitions for your routes and controller methods:

By default, Wayfinder generates files in three directories (wayfinder, actions, and routes) within resources/js, but you can configure the base path:

The --skip-actions and --skip-routes options may be used to skip TypeScript definition generation for controller methods or routes, respectively:

You can safely .gitignore the wayfinder, actions, and routes directories as they are completely re-generated on every build.

Usage

Wayfinder functions return an object that contains the resolved URL and default HTTP method:

If you just need the URL, or would like to choose a method from the HTTP methods defined on the server, you can invoke additional methods on the Wayfinder generated function:

Wayfinder functions accept a variety of shapes for their arguments:

[!NOTE] If you are using a JavaScript reserved word such as delete or import, as a method in your controller, Wayfinder will rename it to [method name]Method (deleteMethod, importMethod) when generating its functions. This is because these words are not allowed as variable declarations in JavaScript.

If you've specified a key for the parameter binding, Wayfinder will detect this and allow you to pass the value in as a property on an object:

Invokable Controllers

If your controller is an invokable controller, you may simply invoke the imported Wayfinder function directly:

Importing Controllers

You may also import the Wayfinder generated controller definition and invoke its individual methods on the imported object:

[!NOTE] In the example above, importing the entire controller prevents the PostController from being tree-shaken, so all PostController actions will be included in your final bundle.

Importing Named Routes

Wayfinder can also generate methods for your application's named routes as well:

Conventional Forms

If your application uses conventional HTML form submissions, Wayfinder can help you out there as well. First, opt into form variants when generating your TypeScript definitions:

Then, you can use the .form variant to generate <form> object attributes automatically:

If your form action supports multiple methods and would like to specify a method, you can invoke additional methods on the form:

Query Parameters

All Wayfinder methods accept an optional, final options argument to which you may pass a query object. This object can be used to append query parameters onto the resulting URL:

You can also merge with the URL's existing parameters by passing a mergeQuery object instead:

If you would like to remove a parameter from the resulting URL, define the value as null or undefined:

Wayfinder and Inertia

When using Inertia, you can pass the result of a Wayfinder method directly to the submit method of useForm, it will automatically resolve the correct URL and method:

https://inertiajs.com/forms#wayfinder

You may also use Wayfinder in conjunction with Inertia's Link component:

https://inertiajs.com/links#wayfinder

Contributing

Thank you for considering contributing to Wayfinder! You can read the contribution guide here.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

Wayfinder is open-sourced software licensed under the MIT license.


All versions of wayfinder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^11.0|^12.0
illuminate/filesystem Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laravel/wayfinder contains the following files

Loading the files please wait ....