pavloniym/nova-iframe-page
Composer 安装命令:
composer require pavloniym/nova-iframe-page
包简介
A Laravel Nova tool.
README 文档
README
This Laravel Nova package allows you to create pages with iframe content, making it easy to embed external websites or internal application pages within your Nova admin panel. The package is fully customizable, enabling you to adjust the iframe's appearance and behavior to suit your needs.
Features
- Customizable Iframe Source: Set the source URL for the iframe content.
- Adjustable Iframe Height: Modify the height of the iframe to fit your layout.
- Disable Scrolling: Option to disable scrolling within the iframe.
- Toggle Top Padding: Control whether the iframe content has top padding.
- Remove Iframe Border: Option to remove the iframe's border for a cleaner look.
- Border Radius: Option to add or remove border radius around the iframe.
- Custom Iframe Styles and Options: Pass additional styles and options to the iframe.
Requirements
- PHP 8.0 or higher
- Laravel 8.x, 9.x, or 10.x
- Laravel Nova 4.x
Installation
You can install the package via Composer:
composer require pavloniym/nova-iframe-page
Usage
Registering the Routes
To register the routes for the iframe page, you need to modify your NovaServiceProvider. Add the following code to the routes method:
use Pavloniym\NovaIframePage\NovaIframePage; class NovaServiceProvider extends NovaApplicationServiceProvider { // ... /** * Register the Nova routes. * * @return void */ protected function routes() { // ... // default nova routes NovaIframePage::make() ->setSrc('https://mycoolsite.com') ->setPath('custom-iframe-path') ->register(); } // ... }
Adding the Tool to the Sidebar Menu
To add the iframe page tool to the Nova sidebar menu, modify the tools method in your NovaServiceProvider as follows:
use Pavloniym\NovaIframePage\NovaIframePage; class NovaServiceProvider extends NovaApplicationServiceProvider { // ... /** * Get the tools that should be listed in the Nova sidebar. * * @return array */ public function tools() { return [ NovaIframePage::make() ->setIcon('server') ->setName('My Cool Site') ->setPath('custom-iframe-path'), ]; } // ... }
Customization Options
The package provides several methods to customize the iframe page:
1. Set the Iframe Source
Set the URL of the page you want to display in the iframe.
NovaIframePage::make()->setSrc('https://mycoolsite.com');
2. Set the Height
You can adjust the height of the iframe using the setHeight method. The height can be any valid CSS height value.
NovaIframePage::make()->setHeight('600px');
3. Disable Scrolling
If you want to disable scrolling within the iframe, use the setNoScroll method.
NovaIframePage::make()->setNoScroll(true);
4. Disable Top Padding
To remove the default top padding of the iframe content, use the setNoTopPadding method.
NovaIframePage::make()->setNoTopPadding(true);
5. Remove Iframe Border
To remove the iframe's border, use the setNoFrameBorder method.
NovaIframePage::make()->setNoFrameBorder(true);
6. Set Border Radius
You can enable or disable the border radius around the iframe using the setWithBorderRadius method.
NovaIframePage::make()->setWithBorderRadius(true);
7. Custom Iframe Styles
You can pass an array of styles to the iframe using the setIframeStyles method.
NovaIframePage::make()->setIframeStyles([ 'border' => '1px solid #ddd', 'margin-top' => '20px', ]);
8. Custom Iframe Options
Additional iframe options can be passed using the setIframeOptions method.
NovaIframePage::make()->setIframeOptions([ 'sandbox' => 'allow-scripts allow-same-origin', ]);
Example
Here's a complete example of how to configure and use the NovaIframePage tool in your Nova admin panel:
use Pavloniym\NovaIframePage\NovaIframePage; class NovaServiceProvider extends NovaApplicationServiceProvider { protected function routes() { Nova::routes() ->withAuthenticationRoutes() ->register(); NovaIframePage::make() ->setPath('/custom-page') ->setSrc('https://example.com') ->setHeight('700px') ->setNoScroll(true) ->setNoTopPadding(true) ->setNoFrameBorder(true) ->setWithBorderRadius(false) ->setIframeStyles([ 'border' => '2px solid #333', 'box-shadow' => '0 0 10px rgba(0, 0, 0, 0.5)', ]) ->setIframeOptions([ 'sandbox' => 'allow-forms allow-popups', ]) ->register(); } public function tools() { return [ NovaIframePage::make() ->setName('Custom Page') ->setPath('/custom-page'), ]; } }
In this example, the iframe page is configured to display a custom page from https://example.com with specific styles, options, and settings.
Conclusion
The Nova Iframe Page Tool for Laravel Nova provides a flexible way to embed external content directly within your Nova admin panel. With customizable settings and easy integration, you can enhance your admin interface by adding iframe pages tailored to your needs.
License
This package is open-source software licensed under the MIT license. Feel free to contribute, report issues, or suggest improvements!
pavloniym/nova-iframe-page 适用场景与选型建议
pavloniym/nova-iframe-page 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.17k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 08 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pavloniym/nova-iframe-page 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pavloniym/nova-iframe-page 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pavloniym/nova-iframe-page 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 1.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-25