fatindeed / emoji-helper
Emoji helper 是一个用于转义emoji字符的工具。
1.0.0
2020-01-13 05:44 UTC
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.0 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-15 12:52:11 UTC
README
Emoji helper 是一个用于转义emoji字符的工具。
为什么要转义emoji字符
对于使用 utf8 字符集的 MySQL 数据库,插入emoji字符时将发生错误。
建议
您应首先尝试将数据库字符集更改为 utf8mb4。如果无法更改,则暂时使用此类。
使用方法
-
在 composer 中引入库。
composer require fatindeed/emoji-helper
-
在 Laravel 或 Lumen 中。
将
Fatindeed\EmojiHelper\Http\Middleware\RemoveEmojiCharacters注册到中间件列表中。 -
非 Laravel 使用方法
use Fatindeed\EmojiHelper\EmojiHelper; // code... $sqlSafeString = EmojiHelper::filter($originalString);