wai/flipbook
Composer 安装命令:
composer require wai/flipbook
包简介
A package for displaying PDFs in a flipbook style
README 文档
README
This package provides a flipbook style PDF viewer for Laravel projects. The PDF viewer is designed to be used out of the box without any implementation required, provided that the required public assets are published. However, the package supports customization of the PDF viewer by allowing for the built-in Blade view files to be published to your project. The PDF viewer can also be embedded directly into any Blade or Vue component to respond to trigger events as a popup dialog.
Installation
Install the package:
composer require wai/flipbook
Publish the required asset files:
php artisan flipbook:install
Optionally publish the Blade view files for customization:
php artisan vendor:publish --provider="Wai\FlipBook\FlipBookServiceProvider" --tag="views" --force
Scheduled Commands
This package supports optional caching of retrieved PDF files. To enable this feature, first publish the config file:
php artisan vendor:publish --provider="Wai\FlipBook\FlipBookServiceProvider" --tag="config"
The config file will be accessible in your project's config folder:
/config/flipbook.php
After enabling the cache config option, this package will run a scheduled command once a day to clean up stale PDFs that have not been viewed for several days. See the following link for running the scheduler:
https://laravel.com/docs/11.x/scheduling#running-the-scheduler
Usage
The necessary controller and routes are set up so that the PDF viewer can be accessed immediately once the package is installed. To access the PDF viewer simply pass the full URL of the PDF you wish to view to the following route:
/pdf?url=full-url-here
For example:
https://example.com/pdf?url=https://example.com/example
You may additionally pass a custom placeholder message for if the PDF cannot be retrieved from the designated URL:
https://example.com/pdf?url=https://example.com/example&text=Not%20found
Customization
Should you need to customize aspects of the PDF viewer, the published Blade view files can be found at the following path inside your project:
/resources/views/vendor/flipbook/
The published public assets (CSS, JS) can be found at:
/public/flipbook/
Local Development
Install composer dependencies:
composer install
Add the package to a local project's composer.json:
{
"scripts": { ... },
"repositories": [
{
"type": "path",
"url": "../path/to/local/git/repo/flipbook"
}
]
}
Install the package:
composer require wai/flipbook
Before committing changes, increment the version number specified in the package's composer.json. Additionally, create a new tag on Bitbucket matching the version number of the package.
wai/flipbook 适用场景与选型建议
wai/flipbook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 325 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wai/flipbook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wai/flipbook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 325
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-21