1. Go to this page and download the library: Download lingodotdev/sdk 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/ */
lingodotdev / sdk example snippets
use LingoDotDev\Sdk\LingoDotDevEngine;
$engine = new LingoDotDevEngine([
'apiKey' => 'your-api-key', // replace with your actual key
'engineId' => 'your-engine-id', // optional — override the default engine
]);
use LingoDotDev\Sdk\LingoDotDevEngine;
// Initialize the SDK with your API key
$engine = new LingoDotDevEngine([
'apiKey' => 'your-api-key',
'engineId' => 'your-engine-id', // optional
]);
// Localize a text string from English to Spanish
$localizedText = $engine->localizeText('Hello, world!', [
'sourceLocale' => 'en',
'targetLocale' => 'es',
]);
// Output: "¡Hola, mundo!"
// Localize an object from English to French
$localizedObject = $engine->localizeObject([
'greeting' => 'Hello',
'farewell' => 'Goodbye',
'messages' => [
'welcome' => 'Welcome to our service',
'thanks' => 'Thank you for your business'
]
], [
'sourceLocale' => 'en',
'targetLocale' => 'fr',
]);
/* Output:
[
'greeting' => 'Bonjour',
'farewell' => 'Au revoir',
'messages' => [
'welcome' => 'Bienvenue dans notre service',
'thanks' => 'Merci pour votre confiance'
]
]
*/