rodrigopedra/laravel-history-navigation
Composer 安装命令:
composer require rodrigopedra/laravel-history-navigation
包简介
History navigation inspired by JavaScript's History API
README 文档
README
History navigation inspired by the browser's History API
composer require rodrigopedra/laravel-history-navigation
- Version 1.0.0 supports Laravel 10.x (and as such, requires PHP 8.1)
- Version 0.9.x supports Laravel from version 6.x through 9.x
Introduction
This package aims to mimic the browser's History API.
It tries to automatically track the navigation history, and provides two global helpers to allow redirecting a user back on history.
The idea was to provide back history navigation to applications which do deep navigation, such as drill-down data dashboards, and doesn't always have a clear back path.
Usage
On a view you can use the navigate_back() helper as the href of a a back link/button:
<a href="{{ navigate_back('/') }}">Go back</a>
The parameter is a default destination, in case the history is empty.
There is also the navigate_default() helper. It will check if a use_default query parameter is present
in the request, if so it will try to redirect to the default route defined as its parameter.
If the query parameter is not present it will defer to navigate_back().
Configuration
You can publish the configuration by running
php artisan vendor:publish --provider=RodrigoPedra\\HistoryNavigation\\HistoryNavigationServiceProvider
You should now have a file called navigate-back.php under your config folder. Below are the default values:
<?php return [ 'default-url' => '/', 'history-limit' => 50, 'skip-patterns' => [], 'query' => [ 'remove-empty' => true, 'ignore-parameters' => ['page'], ], ];
Caveats
This package relies on the user's session, as such if a user has multiple tabs or windows opened and navigates within the same application, it will not work as expected as it will mix the different tabs/windows navigation history.
This package was developed with a very specific scenario in mind, for an intranet application that ran within a single window browser wrapper (similar to electron).
Nowadays, I do not recommend its adoption on new projects, and advise on using the browser's native History API.
rodrigopedra/laravel-history-navigation 适用场景与选型建议
rodrigopedra/laravel-history-navigation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 538 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「history」 「History navigation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rodrigopedra/laravel-history-navigation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rodrigopedra/laravel-history-navigation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rodrigopedra/laravel-history-navigation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An improved history backend module for Neos
Implementation of the Omnibus Directive for Sylius application.
A block to display a list of links to child pages, or pages in current level
Manage a history of your models simply by adding a package for Laravel
Laravel Menu management
Audit changes of your Eloquent models in Laravel/Lumen
统计信息
- 总下载量: 538
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-11