Save Android emoji from Firebase to MySQL using Yii2
<p>I try to import data from <code>Firebase</code> into <code>MySQL</code> database. </p>

<p>My Firebase data looks like this:</p>

<p><a href="https://i.stack.imgur.com/XuvYt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XuvYt.png" alt="enter image description here"></a></p>

<p>Now, I try to get this record and save to MySQL:</p>

<pre><code>$model = new DbModel();
$wpath = "/messages/". $id;
$wvalue = $firebase-&gt;get($wpath);

$wjson = json_decode($wvalue, true);            
$model-&gt;message = $wjson["message"]; //this is ok, if I print it'll show the emoji
$model-&gt;save();
</code></pre>

<p>After I save the model, I get this in my database:</p>

<pre><code>I'm going to dance ????
</code></pre>

<p>I set <code>utf8mb4_general_ci</code> collation for my column in the table, and that seem to <strong>work</strong> when I insert the same text manually via script or UI, however the emoji is not saving when I save my model via php.</p>

<p>My Server version: <code>10.1.16-MariaDB - mariadb.org binary distribution</code></p>

<p>Web server: <code>Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9</code></p>

<p>Any advise would be highly appreciated.</p>