airdev/contact 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

airdev/contact

Composer 安装命令:

composer require airdev/contact

包简介

A package that quickly provide contact form & email send features.

README 文档

README

A package that quickly provide contact form & email send features.

It's only working with Airdev web base project.

Usage

Installation

composer require airdev/contact

Next, add it to the Laravel's package providers in config/app.php

/*
 * Package Service Providers...
 */
Airdev\Contact\AirdevContactProvider::class,

Add Google Recaptcha api to your app.blade.php

<script src="https://www.google.com/recaptcha/api.js"></script>

Publish configuration file

php artisan vendor:publish --tag=airdev-contact-config

You should next update some configuration in config/contact.php :

/* config/contact.php */

return [
    /**
     * To publish config file run :
     * php artisan vendor:publish --tag=airdev-contact-config
     */

    'debug' => false,

    // Class to apply on the submit button (by default, Bootstrap 5 btn classes are used)
    'submit-btn-class' => 'btn btn-primary',
    // Class to apply on <form>
    'form-class' => '',

    // The google captcha keys
    'captcha_secret' => env('CAPTCHA_SECRET', ''),
    'captcha_public' => env('CAPTCHA_PUBLIC', ''),

    'mails' => [
        'contact' => [ // it will generate post route 'contact_post'
            // The address that should receive the sent mail
            'mail_to' => env('MAIL_TO', ''),

            // Subject of the mail
            'mail_subject' => 'Contact du site ' . env('APP_NAME', ''),

            // Redirection after sended the mail
            'redirect' => '/',

            // The mail view to use (you can publish default view to base on and copy it into your resource folder
            'view' => 'mails.mail',
        ],

        /*
         * Just delete this if you have only one form
         */
        'depannage' => [ // it will generate post route 'depannage_post'
            'mail_to' => env('MAIL_TO', ''),
            'mail_subject' => 'Demande de dépannage du site ' . env('APP_NAME', ''),
            'redirect' => '/',
            'view' => 'mails.depannage',
        ]
    ],
];

Call the blade component into your view

And specify the route name you defined into the config/contact.php

<x-airdev-contact::form routeName="contact"></x-airdev-contact::form>
<x-airdev-contact::form routeName="depannage"></x-airdev-contact::form>

You can edit the default fields and the sending button

<x-airdev-contact::form>
    <!--  Editing the fields  -->
    <div>
        <label for="input_name">Nom</label>
        <input required name="name" type="text" id="input_name" placeholder="Votre nom">
    </div>
    <div>
        <label for="input_email">Email</label>
        <input name="email" required type="email" id="input_email" placeholder="Votre email">
    </div>
    <div>
        <label for="input_address">Adresse</label>
        <input name="address" type="text" id="input_address" placeholder="Votre adresse">
    </div>
    <div>
        <label for="input_phone">Téléphone</label>
        <input name="phone" required type="text" id="input_phone" placeholder="Votre téléphone">
    </div>
    <div>
        <label for="input_message">Votre message</label>
        <textarea name="message" id="input_message" placeholder="Votre message"></textarea>
    </div>

    <!--  Editing the sending button  -->
    <x-slot name="button_slot">
        <a href="#" class="link">ENVOYER</a>
    </x-slot>
</x-airdev-contact::form>

You can add custom classes to <form> and <button>

You'll find these settings into the published config file config/contact.php

/* config/contact.php */

return [
    // Class to apply on the submit button (by default, Bootstrap 5 btn classes are used)
    'submit-btn-class' => 'btn btn-primary',
    // Class to apply on <form>
    'form-class' => ''
];

Optional customization

These other customization are not required for the good work of this library.

Publish mail view

If you want to edit the mail that is sent, you can publish the view file. This is often the case when you have more fields than the basic ones in the library.

php artisan vendor:publish --tag=airdev-contact-mail-view

You can now modify the view in the following file :

resources/views/vendor/airdev/contact/mails/mail.blade.php

airdev/contact 适用场景与选型建议

airdev/contact 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 airdev/contact 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 airdev/contact 我们能提供哪些服务?
定制开发 / 二次开发

基于 airdev/contact 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 66
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-18