Download the PHP package nben/filament-record-nav without Composer

On this page you can find all versions of the php package nben/filament-record-nav. 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 filament-record-nav

Filament Record Navigation

A Laravel package that adds elegant next/previous record navigation to your Filament PHP admin panels. Navigate seamlessly between records with intuitive navigation buttons.

License PHP Version Laravel Filament

Features

Requirements

Demo

Live site: rnd.nben.com.np

Watch the demo

Installation

Install the package via Composer:

Optionally publish the config file to customise the order column and sort directions:

Quick Start

Add the two actions to getHeaderActions() on any ViewRecord or EditRecord page. No trait required - this is all you need for the default behaviour.

Out of the box the actions will:


Navigating to the Edit Page

Use ->navigateTo() with the NavigationPage enum to control which page type the action redirects to. Each action can target a different page type independently.

Or mix them:


Navigating to a Custom Route

If your resource registers custom page routes beyond the standard view and edit, use NavigationPage::custom() to navigate to them by route name.

First, register your custom page in the resource's getPages():

Then pass the route name string to NavigationPage::custom():

The route name passed to custom() is forwarded directly to Resource::getUrl($routeName, ['record' => $record]), so it must exactly match a key in your resource's getPages() array.

Note: Custom routes still benefit from the same smart boundary detection - buttons auto-disable and turn gray when there is no adjacent record to navigate to.


Customising Button Appearance

Both actions extend Filament's Action class directly, so every fluent method from the Filament Actions docs works as normal:


Custom Navigation Logic

For custom query logic - filtering by status, scoping to a tenant, ordering by a different column - add the WithRecordNavigation trait to your page class and override the methods you need.

The trait is optional. Only add it when the default config-driven query is not sufficient.

Filtering which records can be navigated

Overriding the navigation URL

Override getRecordNavigationUrl() to fully control where the action redirects. The $page parameter is either a NavigationPage enum case or a CustomNavigationPage value object - both expose a ->value string with the route name.

Or respect whatever page type was passed, including custom routes:

Strict typing with the contract (optional)

If you want IDE autocompletion and static analysis support (PHPStan / Psalm), declare implements HasRecordNavigation alongside the trait:

Note: The actions use method_exists() rather than instanceof to detect navigation methods. This means declaring implements is optional - the actions will call your overridden methods correctly either way. The interface is purely for your own type-safety tooling.


Configuration


Architecture

How it works

When a page renders, Filament evaluates each action's color(), disabled(), and url() closures. Each closure receives the Livewire component instance via Filament's $livewire utility injection - a stable, first-class API that is not expected to change between Filament versions.

Inside each closure, ResolvesAdjacentRecord::getCachedRecord() is called. On the first call it resolves the adjacent record (via the page's override or the config fallback), stores it in $resolvedRecordCache, and returns it. The second and third closure calls read from the cache - so only one database query fires per action per render, regardless of how many closures need the result.

When navigateTo() receives a NavigationPage enum case or a CustomNavigationPage value object, both expose the same ->value string property. resolveUrl() calls Resource::getUrl($page->value, ['record' => $record]) on either type without any instanceof branching, keeping the URL resolution path simple and uniform.

No internal Filament lifecycle hooks (configureAction(), bootUsing(), etc.) are used anywhere in the package.


Troubleshooting

Buttons are always disabled (gray)

Custom filter overrides are being ignored

Wrong page type after navigation

InvalidArgumentException or route not found after using NavigationPage::custom()

Performance on large tables


Upgrade Guide (from v2.0.x)

v2.1.0 is fully backward compatible with v2.0.0. No changes are required to existing code. The only addition is the NavigationPage::custom() named constructor and the CustomNavigationPage value object that supports it.

Upgrade Guide (from v1.x)

v2.0.0 is a full rewrite for Filament v4/v5. Summary of breaking changes:

v1.x v2.x
Trait required on the page Trait optional
configureAction() hook used internally Removed - uses $livewire injection
No page-type enum NavigationPage::View / NavigationPage::Edit / NavigationPage::custom()
getRecordUrl(Model $record) getRecordNavigationUrl(Model $record, NavigationPage\|CustomNavigationPage $page)
Filament ^3.0 Filament ^4.0 \| ^5.0
PHP ^8.1 PHP ^8.2

Migration steps:

  1. Remove configureAction() from any page classes that overrode it - it is no longer used.
  2. Rename getRecordUrl(Model $record) to getRecordNavigationUrl(Model $record, NavigationPage|CustomNavigationPage $page) wherever you defined it. Import both NavigationPage and CustomNavigationPage at the top of the file.
  3. Add ->navigateTo(NavigationPage::Edit) to any actions that previously pointed to edit routes via getRecordUrl().
  4. The trait is now optional - you can remove use WithRecordNavigation from pages that relied only on the default behaviour (no method overrides).

Contributing

Contributions are welcome. Please open an issue before submitting a pull request for major changes so we can discuss the approach first.

License

This package is open-sourced software licensed under the MIT license.

Credits

Support


Made with ❤️ for the Filament PHP community


All versions of filament-record-nav with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 nben/filament-record-nav contains the following files

Loading the files please wait ...