定制 libresign/mailpit-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

libresign/mailpit-client

Composer 安装命令:

composer require libresign/mailpit-client

包简介

Mailpit API Client for PHP - Modern replacement for Mailhog

README 文档

README

A simple PHP (8.2+) client for Mailpit, the modern replacement for Mailhog.

Design Goals

  • As little dependencies as possible (PHP-HTTP compliant via HTTPlug)
  • Simple single client for Mailpit API
  • Integration tests on all endpoints, both happy path and failure paths

Installation

This package does not require any specific HTTP client implementation, but is based on HTTPlug, so you can inject your own HTTP client of choice. So you when you install this library make sure you either already have an HTTP client installed, or install one at the same time as installing this library, otherwise installation will fail.

composer require libresign/mailpit-client <your-http-client-of-choice>

For more information please refer to the HTTPlug documentation for Library Users.

Usage

<?php

use LibreSign\Mailpit\MailpitClient;

$client = new MailpitClient(new SomeHttpClient(), new SomeRequestFactory(), 'http://my.mailpit.host:port/');

Where SomeHttpClient is a class that implements Http\Client\HttpClient from HTTPlug and SomeRequestFactory is a class that implements Http\Message\RequestFactory from HTTPlug, and my.mailpit.host is the hostname (or IP) where Mailpit is running, and port is the port where the Mailpit API is running (by default 1025).

Run tests

Make sure you have Mailpit running and run:

composer cs:check
composer phpmd
composer phpstan
composer test:coverage
composer test:integration
composer test:unit

Running Mailpit for tests

You can either run your own instance of Mailpit or use the provided docker-compose file to run one for you. To run Mailpit with Docker make sure you have Docker installed and run:

docker-compose up -d

Mailpit ports for tests

The tests expect Mailpit to listen to SMTP on port 2025 and to HTTP traffic on port 9025.

If you want different ports you can copy phpunit.xml.dist to phpunit.xml and change the port numbers in the environment variables therein.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固