定制 pvtl/voyager-forms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pvtl/voyager-forms

最新稳定版本:0.4.10

Composer 安装命令:

composer require pvtl/voyager-forms

包简介

Ahoy! - A package to implement forms into Voyager

README 文档

README

The Missing Form Module for The Missing Laravel Admin.

This Laravel package adds dynamic form creation and shortcode insertion to a Voyager project.

  • Create & manage forms and their fields (add fields, drag/drop into order etc)
  • Output forms on the frontend with an simple shortcode ({!! forms(<FORM_ID>) !!})
  • Each form's output on the frontend are overridable with custom layouts
  • All submissions are emailed inside overridable HTML email templates
  • All submissions are backed up to the database and accessible under Voyager Admins > Forms > Enquiries

Built by Pivotal Agency.

Prerequisites

Installation

# 1. Require this Package in your fresh Laravel/Voyager project
composer require pvtl/voyager-forms

# 2. Run the Installer
composer dump-autoload && php artisan voyager-forms:install

# 3. Configure to/from addresses
        -> Navigate to Admin -> Settings -> 'Forms' tab
        -> Adjust values
        -> Note: If you leave `Default Enquiry To Email` blank and set no email in the form setting, email will not be sent
        
# 4. Configure "MAIL" environment variables

# 5. (optional) Add Google invisible reCAPTCHA
        -> Navigate to Admin -> Settings -> 'Admin' tab
        -> Insert Google reCATPCHA keys 

Displaying Forms

You can easily display your created forms on the front-end in any kind of output - we use shortcodes to render our forms so go ahead and add {!! forms(1) !!} to a page/post to see the default Contact form appear.

Form Hooks

You may also wish to include custom logic and functionality when your form has been submitted (but before the submission has saved to the DB - eg. so that you can execute custom validation). This can be done with a Form Hook Block - simply specify your controllers namespace'd path and the method you wish to call and the Voyager Forms module will automatically execute it upon submission. For example:

Pvtl\AwesomeModule\Somewhere\ClassName::anExampleHey('hello world')

Note that in the above example, the first param of the actual method will be the submission data and the second param will be 'hello world'

Custom Form Output

This module outputs forms on the frontend in a basic structure. However you have the ability to build your own form layouts very easily.

A completely custom layout:

  • Create a new blade template in views/vendor/voyager-forms/layouts
  • Edit the form in Voyager Admin and select the new layout you created

To get a completely custom output, you'll likely need to define the <form> html including each form field individually.

Override fields

You also have the ability to override views/vendor/voyager-forms/forms/render.blade.php to change the way form fields are styled.

Custom Email Templates

This module sends a generic looking email with each submission. However you have the ability to build your own email templates very easily.

  • Create a new blade template in views/vendor/voyager-forms/email-templates (you can also simply override default.blade.php in the same location)
  • Edit the form in Voyager Admin and select the appropriate email template

Using Input Types

Most of the input types are fairly self-explanatory. Two non-standard fields are the submit and group fields. Here's how to use them:

Group

You can group your form fields by using two group fields. The label of the first group field will be the title of your grouped fields. You can add your custom css class which will be added to both the grouped field title span and the grouped field div that encapsulates the fields just like any other form element. The default respective classes are .groupedInput and .groupedInputTitle. Because the package doesn't come with any CSS, we encourage you to style both of these classes in your application.

You will need to create a 'group' field in the form builder both where you want your grouped fields to start, and end. If you are missing a closing group field it will be closed at the end of your form automatically.

Submit

You can customize the submit button's text and CSS of your form with the submit input field. You should put this at the end of your form builder.

pvtl/voyager-forms 适用场景与选型建议

pvtl/voyager-forms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.44k 次下载、GitHub Stars 达 63, 最近一次更新时间为 2018 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Forms」 「laravel」 「frontend」 「voyager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pvtl/voyager-forms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pvtl/voyager-forms 我们能提供哪些服务?
定制开发 / 二次开发

基于 pvtl/voyager-forms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 37.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 63
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 63
  • Watchers: 6
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-26