2017 © Pedro Peláez
 

library emoji-images-php

Parses text for emoji names and converts them to corresponding images.

image

jsila/emoji-images-php

Parses text for emoji names and converts them to corresponding images.

  • Sunday, March 22, 2015
  • by JSila
  • Repository
  • 1 Watchers
  • 7 Stars
  • 1,212 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 15 % Grown

The README.md

Emoji Images PHP

Main functionality of the package is parsing text for emoji names (surrounded by double colons) and converting them to corresponding images. It makes use of Twemoji., (*1)

Install

Via Composer, (*2)

``` bash $ composer require jsila/emoji-images-php, (*3)


## Usage ```php $emoji = new JSila\Twemoji\Twemoji; echo $emoji->parseText('Today is :sunny: without a single :cloud:.'); // outputs 'Today is <img src="//twemoji.maxcdn.com/16x16/2600.png" alt="black sun with rays" class=""> without a single <img src="//twemoji.maxcdn.com/16x16/2601.png" alt="cloud" class="">.'

Icons size defaults to 16, but you can override it with 36 or 72. Just pass the appopriate number to constructor., (*4)

$emoji = new JSila\Twemoji\Twemoji(36);

Besides parsing the text for emojis you can also get just the url address for specific emoji., (*5)

$emoji->getUrl(':sunny:');
// outputs '//twemoji.maxcdn.com/16x16/2600.png' 

It can return image of single emoji (not printing it)., (*6)

$emoji->getImage(':sunny:');
// returns '<img src="//twemoji.maxcdn.com/16x16/2600.png" alt="black sun with rays" class="">' 

Both parseText and getImage optionally accept second parameter which represents classes to be applied to img tag (as a string seperated by space or an array of strings), (*7)

$emoji->getImage(':sunny:', 'emoji sunny');
// returns '<img src="//twemoji.maxcdn.com/16x16/2600.png" alt="black sun with rays" class="emoji sunny">' 

Testing

bash $ phpspec, (*8)

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

22/03 2015

dev-master

9999999-dev

Parses text for emoji names and converts them to corresponding images.

  Sources   Download

MIT

The Development Requires

by Jernej Sila

emoji twemoji

22/03 2015

0.1.0

0.1.0.0

Parses text for emoji names and converts them to corresponding images.

  Sources   Download

MIT

The Development Requires

by Jernej Sila

emoji twemoji