All Projects → christofferok → Laravel Emojione

christofferok / Laravel Emojione

Licence: mit
Laravel package to make it easy to use the gorgeous emojis from EmojiOne

Projects that are alternatives of or similar to Laravel Emojione

Nova Indicator Field
A colour-coded indicator field for Laravel Nova
Stars: ✭ 108 (-18.8%)
Mutual labels:  laravel, laravel-package
Laravel Natural Language
This package makes using the Google Natural API in your laravel app a breeze with minimum to no configuration, clean syntax and a consistent package API.
Stars: ✭ 119 (-10.53%)
Mutual labels:  laravel, laravel-package
Laravel Fpdf
Create PDFs with Laravel, provides FPDF version 1.82
Stars: ✭ 108 (-18.8%)
Mutual labels:  laravel, laravel-package
Laravel Paddle
Paddle.com API integration for Laravel with support for webhooks/events
Stars: ✭ 132 (-0.75%)
Mutual labels:  laravel, laravel-package
Laravel Short Url
A Laravel package to shorten urls
Stars: ✭ 127 (-4.51%)
Mutual labels:  laravel, laravel-package
Laravel Excel
🚀 Supercharged Excel exports and imports in Laravel
Stars: ✭ 10,417 (+7732.33%)
Mutual labels:  laravel, laravel-package
Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (-14.29%)
Mutual labels:  laravel, laravel-package
Laravel Google Translate
This package makes using the Google Translate API in your laravel app a breeze with minimum to no configuration, clean syntax and a consistent package API.
Stars: ✭ 97 (-27.07%)
Mutual labels:  laravel, laravel-package
Laravel Meta
Metadata for Eloquent model
Stars: ✭ 124 (-6.77%)
Mutual labels:  laravel, laravel-package
Laravel Mail Editor
MailEclipse ⚡ Laravel Mailable Editor!
Stars: ✭ 1,714 (+1188.72%)
Mutual labels:  laravel, laravel-package
Laravel Enum
Elegant Enum implementation for Laravel
Stars: ✭ 107 (-19.55%)
Mutual labels:  laravel, laravel-package
Laravel Package Generator
A laravel package generator
Stars: ✭ 128 (-3.76%)
Mutual labels:  laravel, laravel-package
Laravel Stats
📈 Get insights about your Laravel or Lumen Project
Stars: ✭ 1,386 (+942.11%)
Mutual labels:  laravel, laravel-package
Cray
A Laravel package to help you generate nearly complete CRUD pages like crazy!
Stars: ✭ 108 (-18.8%)
Mutual labels:  laravel, laravel-package
Elasticsearch Eloquent
⚡️ Eloquent models for Elasticsearch.
Stars: ✭ 100 (-24.81%)
Mutual labels:  laravel, laravel-package
Laravel Geo Routes
GeoLocation restricted routes for Laravel
Stars: ✭ 110 (-17.29%)
Mutual labels:  laravel, laravel-package
Lara Lens
Laravel package for display diagnostic (config, database, http connections...)
Stars: ✭ 96 (-27.82%)
Mutual labels:  laravel, laravel-package
Laravel Tracer
Shows the path of each blade file loaded in a template
Stars: ✭ 96 (-27.82%)
Mutual labels:  laravel, laravel-package
Pagination
🎁 Laravel 5 Custom Pagination Presenter
Stars: ✭ 119 (-10.53%)
Mutual labels:  laravel, laravel-package
Nova Belongsto Depend
Larave Nova BelongsTo Field with Dependcy
Stars: ✭ 128 (-3.76%)
Mutual labels:  laravel, laravel-package

laravel-emojione ❤️

Latest Version on Packagist Total Downloads Software License

😀 🏋🏼 ❤️ ☮

Laravel package to make it easier working with the gorgeous emojis from EmojiOne.

Remember to read the EmojiOne Free License and provide the appropriate attribution. Or buy a premium license

Upgrading from 3.x to 4.x

  1. Update your composer dependency to: "christofferok/laravel-emojione": "^4.0" and run composer update
  2. Update config/emojione.php (if you have one) with 'emojiVersion' => '4.0'

If you are serving the assets yourself then you need to do the following things:

  1. Update your emojione/assets composer dependency to: "emojione/assets": "^4.0" and run composer update
  2. Update config/emojione.php with the correct paths and versions
  3. Publish the assets again. See "Assets" section further down

EmojiOne 4.x/3.x vs 2.0

EmojiOne made a lot of changes in their licensing and which resources are provided in the free license. v2 code is still available in the emojione-v2 branch. If you are upgrading this package, be aware that the SVG assets are not available anymore.

Install

Via Composer

$ composer require christofferok/laravel-emojione

If you are on Laravel 5.4 or lower you need to add the following to your config/app.php file:

Add the ServiceProvider to the providers array in config/app.php

ChristofferOK\LaravelEmojiOne\LaravelEmojiOneServiceProvider::class,

Add this to the aliases array in config/app.php

'LaravelEmojiOne' => ChristofferOK\LaravelEmojiOne\LaravelEmojiOneFacade::class,

Config:

$ php artisan vendor:publish --tag=config --provider="ChristofferOK\LaravelEmojiOne\LaravelEmojiOneServiceProvider"

Usage

LaravelEmojiOne::toShort($str); // - native unicode -> shortnames
LaravelEmojiOne::shortnameToImage($str); // - shortname -> images
LaravelEmojiOne::unicodeToImage($str); // - native unicode -> images
LaravelEmojiOne::toImage($str); // - native unicode + shortnames -> images (mixed input)

Blade (equivalent to LaravelEmojiOne::toImage($str)):

@emojione('😄') -> 😀

@emojione('😄 ❤️') -> 😀❤️

🚨 The output is not escaped so be careful with what you pass into @emojione.

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 LaravelEmojiOne::toShort($str) to convert 😄 and other emoji to 😄 etc.

Comment::create([
  'content' => LaravelEmojiOne::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 😄 🔥

In your view where you display your comments you can use

@emojione($comment->content)

and that will convert 😄 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 emojione/assets

If you want to serve the assets yourself you can publish them with the following commands. Remember to update config/emojione.php

PNG files in sizes 32/64/128:

$ php artisan vendor:publish --tag=public --provider="ChristofferOK\LaravelEmojiOne\LaravelEmojiOneServiceProvider"

In config/emojione.php specify the local path. Remember to specify which size you want in the path (32/64/128).

'imagePathPNG' => '/vendor/emojione/png/64/',

Sprites

If you want to use sprites:

$ php artisan vendor:publish --tag=sprites --provider="ChristofferOK\LaravelEmojiOne\LaravelEmojiOneServiceProvider"

In config/emojione.php enable sprites:

'sprites' => true,
'spriteSize' => 32, // 32 or 64

Add the stylesheet to your HTML:

<link rel="stylesheet" href="/vendor/emojione/sprites/emojione-sprite-{{ config('emojione.spriteSize') }}.min.css"/>

License

Remember to read the EmojiOne Free License and provide the appropriate attribution. Or buy a premium license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].