mamuz / mamuz-contact
为 ZF2 和 Doctrine 提供由 twitter-bootstrap 视图助手渲染的简单联系表单
1.0.1
2015-08-20 21:17 UTC
Requires
- php: >=5.4
- doctrine/doctrine-orm-module: ~0.8
- neilime/zf2-twb-bundle: ~2.4
- zendframework/zend-captcha: ~2.3
- zendframework/zend-code: ~2.3
- zendframework/zend-eventmanager: ~2.3
- zendframework/zend-filter: ~2.3
- zendframework/zend-form: ~2.3
- zendframework/zend-http: ~2.3
- zendframework/zend-i18n: ~2.3
- zendframework/zend-modulemanager: ~2.3
- zendframework/zend-mvc: ~2.3
- zendframework/zend-servicemanager: ~2.3
- zendframework/zend-session: ~2.3
- zendframework/zend-stdlib: ~2.3
- zendframework/zend-validator: ~2.3
- zendframework/zend-view: ~2.3
- zendframework/zendservice-recaptcha: ~2.0.1
Requires (Dev)
- mamuz/php-dependency-analysis: 0.*
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: 0.6.*
README
功能
- 本模块提供基于 ZF2 和 Doctrine2 的联系表单。
- 提交的联系方式将持久保存在仓库中。
- 提供验证码支持,以强制由人类提交。
- 视图与 twitter-Bootstrap 兼容。
安装
推荐通过 mamuz/mamuz-contact
安装方法是通过 composer,在 composer.json
中添加依赖。
{ "require": { "mamuz/mamuz-contact": "*" } }
之后运行 composer update
,并在 ./config/application.config.php
中的 modules
添加 MamuzContact
以启用该模块。
// ... 'modules' => array( 'MamuzContact', ),
本模块基于 DoctrineORMModule
,并确保您已经 配置了数据库连接。
使用 DoctrineORMModule
提供的命令行工具创建数据库表。
./vendor/bin/doctrine-module orm:schema-tool:update
配置
该模块可直接使用,但您可以在 ./config/autoload
目录中添加一个配置文件以覆盖默认配置。有关默认配置,请参阅 module.config.php
。
验证码支持
创建一个新的配置文件并将其放置在 ./config/autoload
目录中,并插入用于 Zend Captcha 表单元素工厂的配置数组。数组必须以键 captcha
为索引,例如。
return array( 'captcha' => array( 'type' => 'Zend\Form\Element\Captcha', 'name' => 'captcha', 'options' => array( 'label' => 'Please verify you are human', 'captcha' => array( 'class' => 'recaptcha', 'options' => array( 'pubkey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'privkey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', ), ), ), 'attributes' => array( 'required' => 'required' ), ), );
Google ReCaptcha WebService 的需求
将您的域注册到 Google ReCaptcha WebService
以创建一个私有密钥和一个公开密钥。请确保私有密钥不会被提交到版本控制系统。
工作流程
在过滤和验证用户输入后,新的联系实体将保存在 MamuzContact
仓库中。
事件
出于简洁考虑,使用 Event
作为 FQN MamuzContact\EventManager\Event
。
以下事件由 Event::IDENTIFIER
mamuz-contact 触发。