PHP code example of charef / free-translate-api
1. Go to this page and download the library: Download charef/free-translate-api 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/ */
charef / free-translate-api example snippets
'providers' => [
Charef\FreeTranslateApi\FreeTranslateAPIServideProvider::class,
];
'aliases' => [
'TranslateAPI' => Charef\FreeTranslateApi\TranslateAPI::class,
];
use Charef\FreeTranslateApi\TranslateAPI;
public function translate()
{
$source = 'ar';
$target = 'en';
$text = 'مرحبا';
$result=TranslateAPI::translate($source, $target, $text);
// Welcome
dd($result);
}