承接 deesynertz/contact-service 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

deesynertz/contact-service

最新稳定版本:v1.1.2

Composer 安装命令:

composer require deesynertz/contact-service

包简介

DB-free contact service package for Laravel 8-11

README 文档

README

A reusable Laravel package to handle contact form submissions and send emails. Designed to be plug-and-play, it allows any Laravel project to receive contact form data and send it to management with minimal setup.

Features

  • Send contact form submissions via email
  • Configurable sender and recipient addresses via .env
  • Built-in config validation with clear error messages
  • Fully tested with unit and feature tests
  • Easy to integrate using a facade or service class

Installation

  1. Require the package via Composer:
composer require deesynertz/contact-service

Deesynertz Contact Service

A reusable Laravel package to handle contact form submissions and send emails.

Installation

Publish the configuration file:

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

This will copy the config to: [config/deesynertz-contact.php]

Configuration

Also ensure Laravel mail settings are properly configured:

MAIL_MAILER=smtp
MAIL_HOST=smtp.yourmail.com
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
MAIL_USERNAME=sender@yourdomain.com
MAIL_PASSWORD=yourpassword
MAIL_FROM_ADDRESS=sender@yourdomain.com
MAIL_FROM_NAME="Your Company Name"

# In your project .env, add the following: Recipient email (Example management)
MAIL_TO_ADDRESS=receiver@yourdomain.com

Config Validation

The package checks required environment variables before sending emails.

If missing, it throws a clear exception: RuntimeException: DEESYNERTZ_CONTACT_MAIL_FROM is not set in your .env

This ensures your system never sends emails without proper configuration.

Usage Options

  1. Sending an email from a controller
use Deesynertz\ContactService\Facades\ContactService;

public function submit(Request $request) {
    # you can put validation first (Optional)

    $data = $request->only(['name', 'email', 'phone', 'message']);
    ContactService::send($data);
    return back()->with('success', 'Your message has been sent!');
}
  1. Sending an email directly via the service
use Deesynertz\ContactService\Services\ContactService;

$service = resolve(ContactService::class);
$service->send([
    'name' => '',
    'email' => '',
    'phone' => '',
    'message' => '',
]);

Quick Start Example: Blade Form

Here’s a minimal contact form you can use:

<form action="{{ route('contact.submit') }}" method="POST">
    @csrf
    <input type="text" name="name" placeholder="Your Name" required>
    <input type="email" name="email" placeholder="Your Email" required>
    <input type="text" name="phone" placeholder="Phone Number">
    <textarea name="message" placeholder="Your Message"></textarea>
    <button type="submit">Send</button>
</form>

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固