fbf/laravel-contact-form
Composer 安装命令:
composer require fbf/laravel-contact-form
包简介
A Laravel 4 package for adding a simple contact form to a website
README 文档
README
A Laravel 4 package for adding a simple contact form to a website
Features
- Partial for a contact form, that you can include in your own views
- Form fields are configurable e.g. name, email and message
- Controller action to handle the submission of the forms, which can handle normal (redirects to previous page), or AJAX requests (responds with JSON with status code and message)
- Translation approach for customising labels, buttons, feedback messages and validation errors
- Enquiry is emailed to a single configurable email address
- Twitter bootstrap compatible markup and class names for the form
Installation
Add the following to you composer.json file
"fbf/laravel-contact-form": "dev-master"
Run
composer update
Add the following to app/config/app.php
'Fbf\LaravelContactForm\LaravelContactFormServiceProvider'
Publish the config, then edit it accordingly
php artisan config:publish fbf/laravel-contact-form
Ensure the settings in app/config/mail.php are correct
Configuration
The URI of contact page
'uri' => 'contact',
The view of the contact page (you can set this to be a view in your app, which has much more contact on it for example, then include the partial for the form, e.g. @include('laravel-contact-form::form'))
'view' => 'laravel-contact-form::contact',
The fields and rules for your form
'fields' => array(
'title' => array(
'type' => 'select',
'choices' => array(
'' => 'Please select',
'Mr' => 'Mr',
'Mrs' => 'Mrs',
'Miss' => 'Miss',
'Ms' => 'Ms',
'Dr' => 'Dr',
'Other' => 'Other',
),
),
'first_name' => array(
'type' => 'text',
),
'last_name' => array(
'type' => 'text',
),
'email' => array(
'type' => 'text',
),
'enquiry' => array(
'type' => 'textarea',
),
),
'rules' => array(
'title' => 'required',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'enquiry' => 'required',
),
The mail configuration options speak for themselves...
'mail' => array(
'views' => array(
'laravel-contact-form::emails.html.enquiry',
'laravel-contact-form::emails.text.enquiry',
),
'to' => array(
'name' => 'Customer Services Manager',
'email' => 'customer.services@company.com',
),
'subject' => 'Website Enquiry',
),
Usage
Customise the options in the config file and then add the following to the view file that you specified in the config to render the contact form inside it.
@include('laravel-contact-form::form')
fbf/laravel-contact-form 适用场景与选型建议
fbf/laravel-contact-form 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.06k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2013 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fbf/laravel-contact-form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fbf/laravel-contact-form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-11-26