Download the PHP package syriable/livewire-navigation without Composer

On this page you can find all versions of the php package syriable/livewire-navigation. 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 livewire-navigation

Livewire Navigation

Know which page the user is on, and which page they came from — inside Livewire requests, per browser tab.

The problem

A browser shows a page. A Livewire component on that page sends requests to Livewire's own endpoint. While handling those requests, Laravel describes the endpoint, not the page:

Page request (GET /users?role=admin) Livewire update from that page
url()->current() /users /livewire/update
request()->route() users.index default-livewire.update
url()->previous() the page before the current page (Referer)
session()->previousRoute() the page before the last page loaded in any tab

There are three different URLs involved:

Livewire remembers the path of the page a component was rendered on (Livewire::originalPath()), but not its query string, its route, or the page before it. This package fills exactly that gap.

Installation

That is all. The service provider is auto-discovered and appends the TrackNavigation middleware to the web middleware group. There is no configuration file.

If your pages use a middleware group other than web, add the middleware to it yourself, after StartSession:

Requires PHP 8.4+, Laravel 12 or 13, and Livewire 3.6+ or 4.

Usage

Every method returns null when the value is unknown and accepts a fallback:

Prefer dependency injection? Type-hint the service instead:

The methods give the same answers during the page request, during every Livewire update from that page, and during other requests sent from it such as a form POST.

Current page

The page the browser tab is displaying. During a Livewire update the URL includes query string changes made after the page loaded (for example by #[Url] properties), so redirecting to Navigation::currentUrl() keeps the user's filters.

currentRoute() returns the route name, or null for an unnamed route.

Previous page

The page the browser tab displayed before the current one.

How it works

  1. When a page renders, the previous page is taken from the browser's same-origin Referer header (which is per tab), falling back to the last page recorded in the session.
  2. The current and previous page are embedded in the memo of every Livewire component on that page. The memo is signed by Livewire's snapshot checksum, so it cannot be tampered with, and it belongs to that tab.
  3. During Livewire updates, the values are read back from the memo of the component being updated. Components rendered during an update inherit them.
  4. After a page response (a successful text/html response to a GET), the middleware stores the page in the session, which serves requests that carry no component, such as a plain form POST.

wire:navigate

wire:navigate loads pages with a normal GET, so they are recorded like any other page. Pages restored from wire:navigate's history cache when using back/forward keep the context their components were rendered with.

Limitations

Testing your application

Drive real requests, and send a Referer header where the browser would:

Livewire::test() does not perform a page request, so inside it the values come from the session.

Documentation

Changelog

See CHANGELOG.md.

Development

License

The MIT License. See LICENSE.md.


All versions of livewire-navigation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
livewire/livewire Version ^3.6|^4.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 syriable/livewire-navigation contains the following files

Loading the files please wait ...