PHP code example of astrotomic / php-twemoji

1. Go to this page and download the library: Download astrotomic/php-twemoji library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

astrotomic / php-twemoji example snippets


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

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)

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)

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