Download the PHP package denobraz/laravel-contact-form without Composer
On this page you can find all versions of the php package denobraz/laravel-contact-form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-contact-form
This small laravel package helps you quickly connect the contact form api for your site by simply defining the types and fields in the configuration file.
Installation
To install the package, run the command:
After installation, you need to publish the configuration file:
After that, you can configure the contact form in the file config/contact_form.php
.
To publish the migration file, run the command:
After that, you can run the migration:
Usage
Registering the routes
To use contact form add the following code to your api routes:
Define contact form types
Default configuration file include default
contact form type with name
, email
, phone
, message
fields.
You can attach callbacks to any type of contact form (notification to the administrator, response to the client, sending an application to the CRM, etc...).
Any callback is Job-like class that extends Denobraz\LaravelContactForm\Callbacks\ContactFormCallback
.
If you want to create queueable callback, you can extend Denobraz\LaravelContactForm\Callbacks\QueueableContactFormCallback
class.
Also, configuration allows you: (Don't forget to notify the users about sensitive data processing)
save_contact_forms
- if you want to store the form data in the databasesave_cookies
- if you want to store the user's cookiessave_ip
- if you want to store the user's ipsave_user_agent
- if you want to store the user's user-agentsave_referrer
- if you want to store the user's referrersave_user_id
- if you want to store the user's id
Examples
Here is example of callback that sends email to the administrator:
Request to /api/contact-form
:
Error response:
Success response:
You can see frontend code example in the demo
directory.