PHP code example of usepolylingo / polylingo

1. Go to this page and download the library: Download usepolylingo/polylingo 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/ */

    

usepolylingo / polylingo example snippets




use PolyLingo\PolyLingo;

$client = new PolyLingo([
    'apiKey' => getenv('POLYLINGO_API_KEY'),
    // 'baseURL' => 'https://api.usepolylingo.com/v1',
    // 'timeout' => 120_000,
]);

$r = $client->translate([
    'content' => '# Hello',
    'targets' => ['es', 'fr'],
    'format' => 'markdown',
]);

echo $r['translations']['es'];