ricadesign / laravel-contact
Creates contact backend and scaffolds frontend of contact form
Installs: 1 210
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 1
Open Issues: 1
Language:Blade
Type:li
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ^6.0 | ^7.0
- laravel/framework: ^9.0| ^8.0 | ^7.0 | ^6.0 | ^5.0
README
This composer package offers a setup for contact form. Provides a default view for the contact form, set routes for the contact form view and the submit of the form, and adds the controller logic to send the information of the form to an email adress.
Installation
Begin by pulling in the package through Composer.
composer require ricadesign/laravel-contact
Next, if using Laravel 5, include the service provider within your config/app.php
file. From version 5.5 and thanks to package autodiscovery this is no longer necesary.
'providers' => [ Ricadesign\Contact\ContactServiceProvider::class, ];
Configuration
You can configure the email adress where the contact form message is sent to by adding the following variables to the .env file.
CONTACT_MAIL=john.doe@example.com
If you need to modify the form view, you can publish the form view with the following command:
php artisan vendor:publish --tag=ricadesign/laravel-contact
This will also publish the config file, contact.php, which you can modify to add the email address or disable the default GET route:
<?php return [ 'email' => env('CONTACT_MAIL', 'john.doe@example.com'), 'use_default_get_route' => true, ];
Usage
Once installed you can navigate to the "/contact" URL of your web application (assuming use_default_get_route config option is set to true). This will show the default view or, in case you have published the view, the custom view for the contact form. You can also generate links to this route using the 'contact' route name.
There is a route for "/contact" that's expecting a post method with the message information to be sent to the contact email.