PHP code example of akeneo / crowdin-api

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

    

akeneo / crowdin-api example snippets



Akeneo\Crowdin\Client;

$project = 'akeneo';
$key     = 'my-api-key';
$client  = new Client($project, $key);

// download last build package from Crowdin
$api = $client->api('download');
$api->setCopyDestination('/tmp/download-crowdin');
$api->setPackage('fr.zip');
$result = $api->execute();

// update a Crowdin file from local filesystem
$api = $client->api('update-file');
$localPath = '/home/nico/git/pim/src/Pim/Bundle/CatalogBundle/Resources/translations/messages.en.yml';
$crowdinPath = 'PimCommunity/CatalogBundle/Resources/translations/messages.en.yml';
$api->addTranslation($localPath, $crowdinPath);
$result = $api->execute();
bash
docker-compose run --rm php vendor/bin/php-cs-fixer fix --config=.php_cs.php --diff
docker-compose run --rm php vendor/bin/phpstan analyze src --level 5
docker-compose run --rm php vendor/bin/phpspec run