1tomany/twig-mailto 问题修复 & 功能扩展

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

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

1tomany/twig-mailto

最新稳定版本:v0.0.2

Composer 安装命令:

composer require 1tomany/twig-mailto

包简介

A Twig extension for safely generating mailto links

README 文档

README

This Twig extension allows you to easily create mailto: links in your templates.

Installation

Install the library with Composer:

composer require 1tomany/twig-mailto

Tag the OneToMany\Twig\MailtoExtension as a Twig extension in your services configuration:

services:
    OneToMany\Twig\MailtoExtension:
        tags: [twig.extension]

Usage

This extension exposes a single function named mailto() with the following signature:

function mailto(string $email, string $subject = '', string $content = ''): string;

In your Twig template, create a mailto: link by calling it like this:

<a href="{{ mailto('contact@example.com', 'I need help!', 'Please help me. Thank you!') }}">
  Email us for help
</a>

This will generate the following value:

mailto:contact@example.com?subject=I%20need%20help%21&amp;body=Please%20help%20me.%20Thank%20you%21

Testing

./vendor/bin/phpunit

Credits

License

The MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-17