PHPackages                             astrotomic/php-twemoji - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. astrotomic/php-twemoji

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

astrotomic/php-twemoji
======================

Easily generate Twemoji URLs

0.2.4(3y ago)3480.0k↑73%13[2 issues](https://github.com/Astrotomic/php-twemoji/issues)[3 PRs](https://github.com/Astrotomic/php-twemoji/pulls)2MITPHPPHP ^7.4 || ^8.0

Since Nov 17Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Astrotomic/php-twemoji)[ Packagist](https://packagist.org/packages/astrotomic/php-twemoji)[ Docs](https://github.com/Astrotomic/php-twemoji)[ Fund](https://forest.astrotomic.info)[ GitHub Sponsors](https://github.com/Gummibeer)[ RSS](/packages/astrotomic-php-twemoji/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (2)

PHP Twemoji
===========

[](#php-twemoji)

[![Latest Version](https://camo.githubusercontent.com/2068ba949b81bf40e0863d1b08c827c80a84e0546548d7924100ce972e688e76/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617374726f746f6d69632f7068702d7477656d6f6a692e7376673f6c6162656c3d52656c65617365267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/astrotomic/php-twemoji)[![MIT License](https://camo.githubusercontent.com/d69da8c67653a3d31ab130af3621304e65aa3447874d79210eb9d6d1d8913c08/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f417374726f746f6d69632f7068702d7477656d6f6a692e7376673f6c6162656c3d4c6963656e736526636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://github.com/Astrotomic/php-twemoji/blob/master/LICENSE)[![Offset Earth](https://camo.githubusercontent.com/d204555ebe1fb0ae82d10c97b4f4ffc2dfdd2ba1489f98be7f7e8708333a0466/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d677265656e3f7374796c653d666f722d7468652d6261646765)](https://plant.treeware.earth/Astrotomic/php-twemoji)[![Larabelles](https://camo.githubusercontent.com/a2c8d5126ddd8c5ddc627176d1d2e0568f8399b50038e71fd7f774c3e24dbe4b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726162656c6c65732d2546302539462541362538342d6c6967687470696e6b3f7374796c653d666f722d7468652d6261646765)](https://www.larabelles.com/)

[![GitHub Workflow Status](https://camo.githubusercontent.com/90f16c810d88feacaefa0a800272d80c3305493441995b6234a19e3e6a3a1ba1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f417374726f746f6d69632f7068702d7477656d6f6a692f72756e2d74657374733f7374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562266c6162656c3d5465737473)](https://github.com/Astrotomic/php-twemoji/actions?query=workflow%3Arun-tests)[![StyleCI](https://camo.githubusercontent.com/13a2cf348b130605101e475d0b0b89e132e99343d4ab6a795518bf6370b5fead/68747470733a2f2f7374796c6563692e696f2f7265706f732f3330373138353935302f736869656c64)](https://styleci.io/repos/307185950)[![Total Downloads](https://camo.githubusercontent.com/2660db5d77654aa94d791b538afc455dd0ef9eb85b02e6181423b70d0d20491d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617374726f746f6d69632f7068702d7477656d6f6a692e7376673f6c6162656c3d446f776e6c6f616473267374796c653d666c61742d737175617265)](https://packagist.org/packages/astrotomic/php-twemoji)

This package provides a fluent PHP OOP builder for [Twemoji](https://twemoji.twitter.com) URLs.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require astrotomic/php-twemoji
```

Usage
-----

[](#usage)

### Single Emojis

[](#single-emojis)

You can use the `Twemoji::emoji()` method to get the Twemoji image URL for a single emoji.

```
use Astrotomic\Twemoji\Twemoji;

Twemoji::emoji('🎉')->url();
// https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/svg/1f389.svg

Twemoji::emoji('🎉')->png()->url();
// https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/1f389.png

Twemoji::emoji('🎉')->base('https://twemoji.astrotomic.info')->url();
// https://twemoji.astrotomic.info/svg/1f389.svg
```

### Multiple Emojis in Text

[](#multiple-emojis-in-text)

If you have a text and want to replace all emojis with Twemoji image tags (Markdown or HTML) you can use the `Twemoji::text()` method. This isn't aware of emojis in attributes or anything - it just finds and replaces all Emojis in the given string.

```
use Astrotomic\Twemoji\Twemoji;

Twemoji::text("Hello 👋🏿")->toMarkdown();
// Hello ![👋🏿](https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/svg/1f44b-1f3ff.svg)

Twemoji::text("Hello 👋🏿")->png()->toMarkdown();
// Hello ![👋🏿](https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/1f44b-1f3ff.png)
```

In case you want to configure the replacer once and bind it to your container for example you can do that as well.

```
use Astrotomic\Twemoji\Replacer;

$replacer = (new Replacer())->png();

$replacer->text("Hello 👋🏿")->toMarkdown();
// Hello ![👋🏿](https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/1f44b-1f3ff.png)
```

You can also override the replacer configuration for the specific replace operation without altering the replacer configuration.

```
$replacer->text("Hello 👋🏿")->svg()->toMarkdown();
// Hello ![👋🏿](https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/1f44b-1f3ff.svg)
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/Astrotomic/.github/blob/master/CONTRIBUTING.md) for details. You could also be interested in [CODE OF CONDUCT](https://github.com/Astrotomic/.github/blob/master/CODE_OF_CONDUCT.md).

### Security

[](#security)

If you discover any security related issues, please check [SECURITY](https://github.com/Astrotomic/.github/blob/master/SECURITY.md) for steps to report it.

Credits
-------

[](#credits)

- [Tom Witkowski](https://github.com/Gummibeer)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Treeware
--------

[](#treeware)

You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to [plant trees](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at [offset.earth/treeware](https://plant.treeware.earth/Astrotomic/php-twemoji)

Read more about Treeware at [treeware.earth](https://treeware.earth)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~138 days

Recently: every ~163 days

Total

7

Last Release

1180d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.1.1PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6187884?v=4)[Tom Herrmann](/maintainers/Gummibeer)[@Gummibeer](https://github.com/Gummibeer)

---

Top Contributors

[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (29 commits)")[![tobyzerner](https://avatars.githubusercontent.com/u/128862?v=4)](https://github.com/tobyzerner "tobyzerner (5 commits)")[![osbre](https://avatars.githubusercontent.com/u/23292709?v=4)](https://github.com/osbre "osbre (3 commits)")[![JoshyPHP](https://avatars.githubusercontent.com/u/317712?v=4)](https://github.com/JoshyPHP "JoshyPHP (2 commits)")[![codedge](https://avatars.githubusercontent.com/u/4409904?v=4)](https://github.com/codedge "codedge (2 commits)")[![tadhgboyle](https://avatars.githubusercontent.com/u/26070412?v=4)](https://github.com/tadhgboyle "tadhgboyle (1 commits)")[![blackwolf12333](https://avatars.githubusercontent.com/u/1572975?v=4)](https://github.com/blackwolf12333 "blackwolf12333 (1 commits)")

---

Tags

phptreewaretwemojiunicodeemojitwemoji

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/astrotomic-php-twemoji/health.svg)

```
[![Health](https://phpackages.com/badges/astrotomic-php-twemoji/health.svg)](https://phpackages.com/packages/astrotomic-php-twemoji)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[joypixels/emoji-toolkit

JoyPixels is a complete set of emoji designed for the web. The emoji-toolkit includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to JoyPixels emoji images. PNG formats provided for the emoji images.

465817.1k7](/packages/joypixels-emoji-toolkit)[voku/portable-utf8

Portable UTF-8 library - performance optimized (unicode) string functions for php.

52322.4M40](/packages/voku-portable-utf8)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[ausi/slug-generator

Slug Generator

8002.2M22](/packages/ausi-slug-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
