stichoza/phemoji

PHP Emoji functions and stuff.

v0.1.1 2015-11-28 20:53 UTC

This package is auto-updated.

Last update: 2024-04-17 10:18:05 UTC


README

Latest Stable Version Total Downloads Downloads Month

Emojis in PHP 🐘

Have you ever envied Swift having possibility to use emojis in code? Well, you can use it in PHP too. I mean, it was possible for years. *Shots fired* 💥 🔫

Installation

Install this package via Composer.

composer require stichoza/phemoji

Usage

Getting Started

After you have installed the package, you can just call Phemoji::init() and you're good to go!

\Stichoza\Phemoji\Phemoji::init();

or

namespace App\Http\Controlers\Blabla;

// ...

use Stichoza\Phemoji\Phemoji;

// ...

Phemoji::init();

Note: This will define some constants and functions in global scope. Once called it will be available everywhere. If you're using any PHP framework, it would be more convinient if you call this method somewhere in middleware or routes or any other place you prefer.

Use of emojis

I have not written full docs yet. You can read the source code and you'll get everything what's going on here.

Example:

With Phemoji Equivalent PHP
✏️(🔠("Hello World!")); printf(strtoupper("Hello World!"));
📄("file.txt"); file_get_contents("file.txt");
📅('Y-m-d', ⏰() + 🎰(1000, 2000)); date('Y-m-d', time() + rand(1000, 2000));
💩(💣('a', 'Katana!!!')); var_dump(explode('a', 'Katana!!!'));
$x = 👍; $x = true;

And so on. Take a look at full list in the source of Phemoji.php

Disclaimer

This package is created just for fun. I am not responsible if any emoji from this package will burn your house to the ground or murder your cute little kitten. Btw, if it ever kills a cat, notify me and I'll remove this repo from Github. I mean Octocat is also a cat.