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&body=Please%20help%20me.%20Thank%20you%21
Testing
./vendor/bin/phpunit
Credits
License
The MIT License
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-17