frenzy/turbolinks
Composer 安装命令:
composer require frenzy/turbolinks
包简介
Frenzy Turbolinks makes following links in your web application faster with Laravel
README 文档
README
Frenzy Turbolinks is a port of the Rails turbolinks gem for projects using the PHP Laravel 6.0+ framework.
Versions
Current versions of the following JavaScript libraries are used:
- turbolinks: v5.2.0
For Laravel 5.1 to 5.7 supports see Frenzy Turbolinks 3.2.3 tag
For Laravel 5.0 supports see Frenzy Turbolinks 3.0.0 tag
For Laravel 4.1 or 4.2 supports see Frenzy Turbolinks 1.0 tag
Performance
Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces only the body and the title in the head.
Performance improvements will vary depending on the amount of CSS and Javascript you are using. You can get up to a 2X increase when using a lot of Javascript and CSS. You can find the Rails benchmarks here.
Installation
Using Composer
Run this command in a terminal:
composer require frenzy/turbolinks
Add the Turbolinks middleware, to the $middlewareGroups array in app/Http/Kernel.php:
\Frenzy\Turbolinks\Middleware\StackTurbolinks::class,
NOTICE: For Laravel 5.4 and below, you must modify your config/app.php, in the providers array add :
Frenzy\Turbolinks\TurbolinksServiceProvider::class
Add these scripts for automatic publication of assets, in your composer.json file:
{
"scripts": {
"post-install-cmd": [
"php artisan vendor:publish --provider=\"Frenzy\\Turbolinks\\TurbolinksServiceProvider\" --force"
],
"post-update-cmd": [
"php artisan vendor:publish --provider=\"Frenzy\\Turbolinks\\TurbolinksServiceProvider\" --force"
]
}
}
Add Javascript files into your project
Usage
Using turbolinks requires both the usage of the javascript library and the event listeners included with the component.
Javascripts
Both the original coffeescript version and compiled version of each script are available for use.
Using turbolinks.js
To enable turbolinks, all you need to do is add the compiled turbolinks javascript to your layout in the <head>section.
Installation with the Larasset package
Click here to publish the assets automatically.
Compatibility
The turbolinks javascript is designed to work with any browser that fully supports pushState and all the related APIs. This includes Safari 6.0+ (but not Safari 5.1.x!), IE10+, and latest Chrome and Firefox.
Do note that existing JavaScript libraries may not all be compatible with Turbolinks out of the box due to the change in instantiation cycle. You might very well have to modify them to work with Turbolinks' new set of events. For help with this, check out the Turbolinks Compatibility project.
Additional Resources
Please refer to the turbolinks project if you require additional information on the javascript libraries and their usage.
Bugs
For bugs or feature requests, please create an issue.
Credits
This package is based on the Symfony middleware package Helthe Turbolinks.
frenzy/turbolinks 适用场景与选型建议
frenzy/turbolinks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.33k 次下载、GitHub Stars 达 160, 最近一次更新时间为 2014 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「assets」 「javascript」 「ajax」 「laravel」 「pjax」 「turbolinks」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 frenzy/turbolinks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 frenzy/turbolinks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 frenzy/turbolinks 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Asset Management for PHP
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
Selenium4 (WebDriver) driver for Mink framework
laravel middleware to allow ajax only calls
统计信息
- 总下载量: 23.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 161
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-01-29