hdvinnie/laravel-joypixel-emojis
Composer 安装命令:
composer require hdvinnie/laravel-joypixel-emojis
包简介
Laravel helper for Joypixels emojis
README 文档
README
Laravel package to make it easier working with the modern emojis from Joypixels.
installation
Via Composer
$ composer require "hdvinnie/laravel-joypixel-emojis"
$ composer update
If you are on a Laravel that does not have Auto Discovery or you have it disabled then you need to add the following to your config/app.php file:
Add the ServiceProvider to the providers array in config/app.php
hdvinnie\LaravelJoyPixels\LaravelJoyPixelsServiceProvider::class,
Add this to the aliases array in config/app.php
'LaravelJoyPixels' => hdvinnie\LaravelJoyPixels\LaravelJoyPixelsFacade::class,
Config:
$ php artisan vendor:publish --tag=config --provider="hdvinnie\LaravelJoyPixels\LaravelJoyPixelsServiceProvider"
Usage
LaravelJoyPixels::toShort($str); // - native unicode -> shortnames LaravelJoyPixels::shortnameToImage($str); // - shortname -> images LaravelJoyPixels::unicodeToImage($str); // - native unicode -> images LaravelJoyPixels::toImage($str); // - native unicode + shortnames -> images (mixed input)
Blade (equivalent to LaravelJoyPixels::toImage($str)):
🚨 The output is not escaped so be careful with what you pass into @joypixels.
More details about how toImage($str) works can be found at https://github.com/Ranks/emojione/blob/master/examples/PHP.md
Example
You want to let users put emoji a comment.
When you are saving a comment, you might want to run the content through LaravelJoyPixels::toShort($str) to convert 😄 and other emoji to :smile: etc.
Comment::create([ 'content' => LaravelJoyPixels::toShort(request('content')) ]);
So if someone leaves a comment like This is an awesome comment 😄🔥 it will be saved as This is an awesome comment :smile: :fire:
In your view where you display your comments you can use
@joypixels($comment->content)
and that will convert :smile: and 😄 to the emojione equivalent.
Assets
By default it will use the assets from JSDelivr.
Remember to run this before trying to publish any of the assets:
composer require joypixels/assets
If you want to serve the assets yourself you can publish them with the following commands. Remember to update config/joypixels.php
PNG files in sizes 32/64/128:
$ php artisan vendor:publish --tag=public --provider="hdvinnie\LaravelJoyPixels\LaravelJoyPixelsServiceProvider"
In config/joypixels.php specify the local path. Remember to specify which size you want in the path (32/64/128).
'imagePathPNG' => '/vendor/joypixels/png/64/',
Sprites
If you want to use sprites:
$ php artisan vendor:publish --tag=sprites --provider="hdvinnie\LaravelJoyPixels\LaravelJoyPixelsServiceProvider"
In config/joypixels.php enable sprites:
'sprites' => true, 'spriteSize' => 32, // 32 or 64
Add the stylesheet to your HTML:
<link rel="stylesheet" href="/vendor/joypixels/sprites/emojione-sprite-{{ config('emojione.spriteSize') }}.min.css"/>
hdvinnie/laravel-joypixel-emojis 适用场景与选型建议
hdvinnie/laravel-joypixel-emojis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88.92k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「emoji」 「laravel」 「emojione」 「JoyPixels」 「HDVinnie」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hdvinnie/laravel-joypixel-emojis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hdvinnie/laravel-joypixel-emojis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hdvinnie/laravel-joypixel-emojis 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
EmojiOne is a complete set of emojis designed for the web. It includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to our custom emoji images. PNG format provided for the emoji images.
Emoji in png format brought to you by JoyPixels. JoyPixels is a complete set of emojis designed for the web. Licensing required: https://www.joypixels.com/licenses.
Emojis in png format brought to you by EmojiOne. EmojiOne is a complete set of emojis designed for the web.
Laravel helper for EmojiOne
A Laravel 5 Package for Using & Working With Emojis
A php class that has descriptive names for the emojis and said emojis as its value
统计信息
- 总下载量: 88.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-09