Add the "johntaa/ar-php": "dev-master" into the require section of your composer.json. Run composer install.
<?php
use Johntaa\Arabic\I18N_Arabic;
$Arabic = new I18N_Arabic('Glyphs');
$text ="";
$text = $Arabic->utf8Glyphs($text);
My application producing Images using GD extension and these images conatain arabic phrases, but GD cannot understand how to connect these phrases letters , So this great library helped me to solve this problem.
For more support in using arabic language in php, I think this site deserve a visit: PHP Arabic -- Ar-PHP