magan/feedback

This package helps to create quick contact-us form and send email to the admin.

1.0.1 2024-03-22 18:28 UTC

This package is auto-updated.

Last update: 2024-11-05 07:03:02 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

This package is a simple feedback form that uses google recaptcha to prevent spam. It sends an email to the address set in the .env file. This package helps to generate simple contact-us form with google recaptcha.

Installation

Via Composer

composer require magan/feedback

Usage

Set up your google recaptcha keys inside your .env file.

GOOGLE_RECAPTCHA_SITE_KEY=YOUR_SITE_KEY 
GOOGLE_RECAPTCHA_SECRET_KEY=YOUR_SECRET_KEY

Set up your mailing address.

MAIL_TO_ADDRESS="hello@example.com"
MAIL_FROM_ADDRESS="hello@example.com"

You can publish the config file with:

php artisan vendor:publish --provider="Magan\Feedback\FeedbackServiceProvider" --tag='feedback-config'

You can publish and edit the views with:

php artisan vendor:publish --provider="Magan\Feedback\FeedbackServiceProvider" --tag='feedback-views'

Publish config file content

<?php
/*
    |--------------------------------------------------------------------------
    | Setup your google recaptcha keys
    |--------------------------------------------------------------------------
    |
    | You can set use of google recaptcha by setting use to true.
    | Please set MAIL_TO_ADDRESS and MAIL_FROM_ADDRESS inside your .env file.
    |
    */
return [
    'route' => [
        'prefix' => 'feedback',
        'middleware' => ['web'],
    ],
    'recapthca' => [
        'site_key' => env('GOOGLE_RECAPTCHA_SITE_KEY', null),
        'secret_key' => env('GOOGLE_RECAPTCHA_SECRET_KEY', null),
        'use' => false,
    ],
    'mail' => [
        'to' => [
            'address' => env('MAIL_TO_ADDRESS', 'hello@gmail.com'),
        ],
        'from' => [
            'address' => env('MAIL_FROM_ADDRESS', 'hello@gmail.com'),
        ],
    ],
];

Route:

You can change route of your feedback page by changing the configuration key route.

http://120.0.0.1/feedback

Change log

Please see the changelog for more information on what has changed recently.

Testing

composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author@email.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.