PHP code example of nf / contact-form
1. Go to this page and download the library: Download nf/contact-form library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nf / contact-form example snippets
'providers' => [
// .... Others providers
\Vicoders\ContactForm\ContactFormServiceProvider::class
],
// publish needed file
php command contact:publish
// migrate database
php command migrate
use Vicoders\Input\Abstracts\Input;
use Vicoders\Input\Abstracts\Type;
use Vicoders\ContactForm\Facades\ContactFormManager;
ContactFormManager::add([
'name' => 'Contact',
'type' => Type::CONTACT,
'style' => 'form-1',
'email_enable' => true, /* default - false */
'email_variables' => [
'name' => 'NAME_FIELD',
'email' => 'EMAIL_FIELD'
],
'email_config' => [
'domain_api' => 'http://sendmail.vicoders.com/',
'mail_host' => 'HOST MAIL',
'mail_port' => 'PORT',
'mail_from' => 'EMAIL_FROM',
'mail_name' => 'YOUR NAME',
'mail_username' => 'EMAIL SEND',
'mail_password' => 'EMAIL PASSWORD',
'mail_encryption' => 'tls',
],
'email_template' => [
[
'name' => 'Template 1',
'path' => 'PATH_TO_HTML_TEMPLATE',
'params' => [
'name_author' => 'Garung 123',
'post_title' => 'this is title 123',
'content' => 'this is content 123',
'link' => 'http://google.com',
'site_url' => site_url(),
]
],
[
'name' => 'Template 2',
'path' => 'PATH_TO_HTML_TEMPLATE',
'params' => [
'example_variable' => 'demo'
]
]
],
'status' => [
[
'id' => 1,
'name' => 'pending',
'is_default' => true
],
[
'id' => 2,
'name' => 'confirmed',
'is_default' => false
],
[
'id' => 3,
'name' => 'cancel',
'is_default' => false
],
[
'id' => 4,
'name' => 'complete',
'is_default' => false
]
],
'fields' => [
[
'label' => 'Text',
'name' => 'firstname', // the key of option
'type' => Input::TEXT,
'attributes' => [
' true,
'class' => 'col-sm-12 form-control',
'placeholder' => 'Please fill field',
],
],
[
'name' => 'date',
'type' => Input::DATE,
'attributes' => [
'
[nf_contact_form name="{form_name}"]
do_shortcode("[nf_contact_form name='Contact']")
[nf_contact_form name="Contact"]