PHPackages                             luyadev/luya-module-contactform - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. luyadev/luya-module-contactform

ActiveLuya-module[Utility &amp; Helpers](/categories/utility)

luyadev/luya-module-contactform
===============================

This module provides a very fast and secure way to create customizable contact forms.

1.2.0(3y ago)317.7k↓50%41MITPHP

Since Mar 25Pushed 2y ago4 watchersCompare

[ Source](https://github.com/luyadev/luya-module-contactform)[ Packagist](https://packagist.org/packages/luyadev/luya-module-contactform)[ Docs](http://luya.io)[ RSS](/packages/luyadev-luya-module-contactform/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (21)Used By (1)

 [![LUYA Logo](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)

Contactform Module
==================

[](#contactform-module)

[![Tests](https://github.com/luyadev/luya-module-contactform/actions/workflows/tests.yml/badge.svg)](https://github.com/luyadev/luya-module-contactform/actions/workflows/tests.yml)[![Maintainability](https://camo.githubusercontent.com/fb7ed1b1f3036863735c6766aaf49c1db562c3b34de4992cd6931188f1d110c4/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f30313637326632643062393361313761313536622f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/luyadev/luya-module-contactform/maintainability)[![Test Coverage](https://camo.githubusercontent.com/daed68e85944538212388d37ede45959c7461af786099dc0545af8756cc583d0/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f30313637326632643062393361313761313536622f746573745f636f766572616765)](https://codeclimate.com/github/luyadev/luya-module-contactform/test_coverage)[![Total Downloads](https://camo.githubusercontent.com/9cfc47534010bb062b5b7fdfcd9bbe8fb6847c44a063d23f8ef9b8010bfe32b2/68747470733a2f2f706f7365722e707567782e6f72672f6c7579616465762f6c7579612d6d6f64756c652d636f6e74616374666f726d2f646f776e6c6f616473)](https://packagist.org/packages/luyadev/luya-module-contactform)

This module provides a very fast and secure way to create customizable contact forms.

Installation
------------

[](#installation)

Require the contact module via composer

```
composer require luyadev/luya-module-contactform
```

add the contact form module to your config:

```
'modules' => [
    // ...
    'contactform' => [
        'class' => 'luya\contactform\Module',
        'useAppViewPath' => true, // When enabled the views will be looked up in the @app/views folder, otherwise the views shipped with the module will be used.
        'mailTitle' => 'Contact Form',
        'attributes' => [
            'name', 'email', 'street', 'city', 'tel', 'message',
        ],
        'rules' => [
            [['name', 'email', 'street', 'city', 'message'], 'required'],
            ['email', 'email'],
        ],
        'recipients' => [
            'admin@example.com',
        ],
    ],
    // ...
],
```

To defined the attribute labels you can configure the module as followed:

```
'attributeLabels' => [
    'email' => 'E-Mail',
],
```

By default LUYA will wrap the value into the `Yii::t('app', $value)` functions so you are able to translate the attributes labels. The above exmaple would look like this `Yii::t('app', 'E-Mail')`.

#### Integrate the Module

[](#integrate-the-module)

In order to use the module inside the LUYA CMS, just pick the `Module Block` and drag the block into the page. After droped the block edit the module block and picke the `contactform` module. This will then maybe throw an exception that there is no view file. In order to create the view file follow the next section.

#### View Files

[](#view-files)

Typically view files are located in `views` folder of your project root, create the view file for the corresponding model data at `views/contactform/default/index.php` with the following content:

```

    The form has been submitted successfully.
