Download the PHP package janvince/smallcontactform without Composer

On this page you can find all versions of the php package janvince/smallcontactform. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package smallcontactform

Small Contact form

Simple but flexible contact form builder with custom fields, validation and passive antispam.

Installation

GitHub clone into /plugins dir:

OctoberCMS backend

Just look for 'Small Contact Form' in search field in:

Settings > Updates & Plugins > Install plugins

Permissions

Settings > Administrators

You can set permissions to restrict access to Settings > Small plugins > Contact form and to messages list.

Installation with composer

Setup new Contact form

Settings > Small Contact form

FORM

Enable AJAX

By default, sending form will trigger page reload. With AJAX, everything can be done without page reloading which will be more user friendly.
If user's browser doesn't support (or has disabled) JavaScript, form will still work with page reloads after send.

Add Assets

If you want to start quickly, you can enable Add assets checkbox - and then Add CSS and JS assets.
This will include necessary styles (Bootstrap, AJAX, October AJAX) and scripts (jQuery, Bootstrap, October AJAX framework and extras).

But you have to include Twig tags and into your layout or page like this:

`

If you want to insert assets by hand, you can do it this way (or similar):

`

Notes

You can add your notes that can be displayed in mail templates. Field is accesiible with {{ form_notes }}.

Form notes content can be overriden in component's properties.

SEND BUTTON

Redirection after the form is sent

You have some options to control redirection after form is successfully sent:

If you use markup parameter do not forget to allow form redirection in form main settings or (rather) in component parameters ! There is no markup parametr to allow redirection.

FIELDS

Here you can add fields to build your contact (or other) form.

The idea is simple (and solution is so I hope):

When dropdown is selected there will be values/options repeater shown. You can add as many values you need.

Hint: you can add dropdown empty option by adding a value with empty ID.

You can also use Custom code and have complete control of generated code.

There is also a Custom content field to add formated content in place of a field.

Field data validation

You can select from predefined rules or add custom Validator rules (read documentation).

Some rules require additional validation pattern some of them not.

Hint: For dropdown validation you can use custom validation type with rule in and list of IDs in pattern field (eg: 1,2,3).

Note: There is a custom_not_regex validation rule as an inverse to built in regex.

COLUMNS MAPPING

System writes all form data in database, but for quick overview Name, Email and Message columns are visible separately in Messages list.

But you have to help system to identify these columns by mapping to your form fields.

These mappings are also used for autoreply emails where at least Email field mapping is important.

ANTISPAM

Passive antispam

Very simple implementation of passive antispam (inspired by Nette AntiSpam Control).

The idea behind this is to check how fast is form send and if robots-catching field is filled.

Google reCaptcha

Implementation of Google reCaptcha antispam protection.

Setup

First you have to create new API keys pair in reCaptcha admin panel.

Hit Get reCAPTCHA button on reCaptcha wellcome page. Set label and check reCAPTCHA v2 (or v2 invisible) option and hit button Register.

Copy Site key and Secret key to Contact Form's settings fields.

If you want Contact Form to automatically include server scripts in your layout, check the button in Form settings.

reCaptcha invisible

If you use reCaptcha invisible and want to hide reCaptcha badge, you can add to your styles:

But remember to add info about Privacy policy near your contact form (or as a custom content field).

Check sender's IP

You can add an extra form protection with limit submits from one IP address.

This check has own error message and custom field to set maximum submits.

EMAIL

Mails can be sent directly or queued (OctoberCMS queue must be configured!).

Don't forget to configure mail preferences in Settings > Mail > Mail configuration!

Data in email templates

There are variables available in all email templates:

Allow autoreply

Email can be send to form sender as confirmation.

Allow notifications

Once a Contact form is sent a notification can be immediately send to a provided email address (or comma-separated list of addresses).

A Reply to address of notification email will be set to an email address from Contact form (if this field is used).

You can also force From address to be set to the one entered in Contact form - but not all email systems support this!

TRANSLATION

You can allow translation with RainLab Translate plugin.

After installation of Translate plugin, please add at least two languages in Settings > Translate > Manage languages. For translations to work there must be a localePicker component included in your layout/page.

Form texts

Most of Small Contact form texts can be edited right in Settings > Small plugins > Contact form.

Custom form fields

Translate plugin doesn't supports translation of individual repeater fields yet, so form field texts (label, validation error messages) have to be - for now - translated in a dictionary: Settings > Translate > Translate messages

Please note that form fields labels will be shown in dictionary after first form render (on your frontend page) and validation error messages after first send.

Email templates

You can create your own email templates in Settings > Mail > Mail templates (for hint look inside of default templates starting with janvince.smallcontactform::).

Remember your email templates CODE and put in in Small Contact form email settings in Settings > Small plugins > Contact form > Email tab. For each language there can be specific template.

There are {{fields}} and {{fieldsDetails}} arrays available inside of email templates.

You can also use {{url}} variable to get original request URL.

If your custom form field has name eg. 'email', you use it in template with `.

You can itterate over uploaded files with:

You can access model data with eg. {{ messageObject.id }}.

GOOGLE ANALYTICS

if you want to use these settings, be sure to have Google Analytics scripts included on your site. You can use Rainlab Google Analytics plugin.

Events

You can allow events to be send to your GA account when the form is successfully sent.

There are (translatable) fields for category, action and label.

All event settings can be overriden in component property so if you use more then one form, you can custommize events for each of them.

MESSAGES LIST

All sent data from Contact form are saved and listed in backend Messages list.

If email, name and message fields are assigned on Settings > Small plugins > contact form > Columns mapping tab, they will be saved and shown in separate columns.

You can click on a record to see all form data. The message will be marked as read.

DASHBOARD REPORT WIDGETS

There are available report widgets to be used on OctoberCMS dashboard.

Messages stats

Shows basic messages statistics.

New messages

Shows number of new messages. The color changes to green if there are any.

You can simply click widget to open Messages list.

Overriding form settings

You can override some of the form settings in component dropdown (on page or layout) or by passing them in component call.

Form settings

There is also an Alias column that contain component's alias of the used form and is saved in messages log (this field is invisible by default in messages table).

`

You can override form's property in Twig component tag, eg:

`

This can be even more complex: `

In email template you can access some of these variables like this: `

When you override form description in `, description will be added as a hidden field into a form. Do not use this to store private data as this is easily visible in page HTML code!

Override notification email options

You can set different email address to which notification about sent form will be delivered and also change a notification template.

Template must exist in Settings > Mail > Mail configuration.

If you add a locale string to property (like) than that one has priority and will be used if returns.

`

Local strings in notification_template canot be used in Twig!

Override autoreply email options

You can set different email address and name for autoreply message and also use different autoreply template.

Template must exist in Settings > Mail > Mail configuration.

If you add a locale string to or property (like or) than that one has priority and will be used if returns.

`

Do you know that you can use form variables in an email template subject. In Settings > Mail templates create new template and set the Subject field to eg: My form {{ fields.form_alias }}.

Disable some form fields

You can disable some of defined form fields by passing their names in ` component property.

Several fields can be added while separated with pipe `.

`

Or you can disable some of functions:

`


HOWTO

Fight SPAM

Prohibit sending URLs in a (message) field.

Custom regex to prevent sending URLs

Add an empty option to dropdown field

You can easily add an empty option with empty ID and some value.

Dropdown empty field

Validate dropdown field

If you want to validate dropdown options, you can use custom validation rule in with list of IDs as a validation pattern.

Dropdown validation


My thanks goes to:
OctoberCMS team members and supporters for this great system.
Andrew Measham for his photo.
Font Awesome for nice icons.

Created by Jan Vince, freelance web designer from Czech Republic.


All versions of smallcontactform with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
composer/installers Version ~1.0
google/recaptcha Version ^1.2@dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package janvince/smallcontactform contains the following files

Loading the files please wait ....