burdaforward/bf-prg-bundle
Composer 安装命令:
composer require burdaforward/bf-prg-bundle
包简介
This bundle helps you to implement the PRG pattern into your application.
README 文档
README
The BFPrgBundle adds support for masking urls based on PRG-Pattern.
For more information about this pattern please take a closer look to the following url: Post/Redirect/Get
Note: This bundle is built for use in a symfony application.
Installation & Setup
-
Run
composer require burdaforward/bf-prg-bundleor download teh bundle to you local vendor directory -
Activate this bundle
- It should be activated automatically if you have Symfony Flex installed
- Manually via
src/Kernel.phporconfig/bundles.php
... class Kernel extends BaseKernel { ... public function registerBundles() { $bundles = array( ... new BurdaForward\BFPrgBundle\BFPrgBundle(), ... ); return $bundles; } ... }
-
Add the bundle to your routing configuration like
config/routes.yamlprg: resource: "@BFPrgBundle/Resources/config/routing.yml"
This routing.yml enables a required route
/prg_resolve. -
In the last step you need to include the basic template of that bundle into your templates.
(Best position is before closing body tag.)
{% include '@BFPrg/prg_form.html.twig' %}
Usage & Examples
The bundle provides a twig function you can call in your templates.
Function name: prg_link
Function parameter:
url: Destination URL including GET parameter
title: Label of the masked link. e.g. <a href="#">TITLE</a>
options: This is an array the supports the following options.
class: you can set the css class of the rendered element
element: the default is "span" but if you want to render a "button", "div" or "a" you can set it with this option
target: you can define if the link should open in the same window (default value) or in a new one
valid values are
- _self (same frame)
- _top (same window
- _blank (new window)
only_open_tag: has to be set true or false - the result will only return the opening tag of a prg link
ATTENTION: You have to close the tag by yourself.
Basic example:
{{ prg_link('http://example.org?q=sample', 'Click me')|raw }}
Result: <span class="prg-link" data-submit="aHR0cDovL2V4YW1wbGUub3JnP3E9c2FtcGxl" data-target="_self">Click me</span>
Stylesheet example:
{{ prg_link('http://example.org?q=sample', 'Click me', {class: 'my-link'})|raw }}
Result: <span class="prg-link my-link" data-submit="aHR0cDovL2V4YW1wbGUub3JnP3E9c2FtcGxl" data-target="_self">Click me</span>
Target example
{{ prg_link('http://example.org?q=sample', 'Click me', {target: '_blank'})|raw }}
Result: <span class="prg-link" data-submit="aHR0cDovL2V4YW1wbGUub3JnP3E9c2FtcGxl" data-target="_blank">Click me</span>
Element example:
{{ prg_link('http://example.org?q=sample', 'Click me', {element: 'button'})|raw }}
Result: <button class="prg-link" data-submit="aHR0cDovL2V4YW1wbGUub3JnP3E9c2FtcGxl" data-target="_self">Click me</button>
Only Open Tag example:
{{ prg_link('http://example.org?q=sample', 'Title will be ignored', {only_open_tag: true)|raw }}
Result: <span class="prg-link" data-submit="aHR0cDovL2V4YW1wbGUub3JnP3E9c2FtcGxl" data-target="_self">
Contact
For questions and improvements contact us.
burdaforward/bf-prg-bundle 适用场景与选型建议
burdaforward/bf-prg-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.35k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 05 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 burdaforward/bf-prg-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 burdaforward/bf-prg-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-22