grofgraf/laravel-contact-form is a Laravel package for contact form for laravel.
It currently has 0 GitHub stars and 29 downloads on Packagist (latest version 1.0.0).
Install it with composer require grofgraf/laravel-contact-form.
Discover more Laravel packages by grofgraf
or browse all Laravel packages to compare alternatives.
Last updated
Contact form package for Laravel. Automatic creation of routes, controllers, email templates and views needed for contact form. Option of enabling captcha validation and sending mail attachments.
Laravel 5.5 or above $ composer require grofgraf/laravel-contact-form
First add the service provider to the main configuration file located at config/app.php
'providers' => [
...
GrofGraf\LaravelContactForm\Providers\ContactServiceProvider::class
]
Now you can navigate to /contact and you will see a default contact form.
If you want to enable human verification, you have to register a site with Google reCAPTCHA and receive a pair of keys.
After that, you can add those keys to your .env file.
RECAPTCHA_SITEKEY=<your_site_key>
RECAPTCHA_SECRET=<your_secret_key>
If only site key is defined, the client side validation is performed without server validation
If both keys are defined client and server side validation is performed.
If client key or both keys are undefined, no validation is performed and reCAPTCHA widget is not displayed by default.
By default, all mime types are enabled for mail attachment. You can disable or enable mail attachment, or change allowed mime types, by editing the configuration file. To do so, you want to publish the configuration file by running
$ php artisan vendor:publish --tag=config
In the config directory contact.php file will be generated, where you can change attachment_mimetypes value.
To allow only certain mime types list them as array:
...
'attachment_mimetypes' => ['application/pdf', 'text/*'],
...
By leaving array empty 'attachment_mimetypes' => [], attachment will be disabled and input field won't be shown in email form.
To allow all mime types for attachment, set the value to 'attachment_mimetypes' => ['*'].
To override configuration file, run php artisan vendor:publish --tag=config command, that will create config/contact.php file. By editing this file you can choose between different configuration options, like enabling or disabling autoreply and human verification, adding addresses to mail carbon copy (cc), or choosing attachment mime types.
If you don't want to publish configuration file, you can override some options by assigning variables in
.envfile.
If you want to make changes to the views, you can publish them by running php artisan vendor:publish --tag=views in the root of your project.
By running this command the files that override the default views will be generated and stored to the /resources/views/contact directory. Now you can edit them as you wish and make then fit your needs. By default, available variables for your email templates are:
$name name of the sender$email email of the sender$subject email subject$content content of emailBy running php artisan vendor:publish --tag=mail command, Contact.php and Autoreply,php files will be generated in app\Mail directory. In these file you can override mail logic.
By running php artisan vendor:publish --tag=controllers command, 'ContactController.php' will be generated in app\Mail directory. Here you can override controllers logic.
By running php artisan vendor:publish --tag=routes command, contact.php file will be generated in routes directory. In this file, you can override used paths or assign them to different controllers.
The MIT License (MIT)
Copyright (c) 2017 GrofGraf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.