2017 © Pedro Peláez
 

library crowdin-api

Crowdin PHP API client

image

akeneo/crowdin-api

Crowdin PHP API client

  • Friday, November 18, 2016
  • by Akeneo
  • Repository
  • 19 Watchers
  • 32 Stars
  • 34,488 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 5 Forks
  • 9 Open issues
  • 11 Versions
  • 4 % Grown

The README.md

php-crowdin-api

A simple PHP Crowdin API client http://crowdin.net/page/api., (*1)

Crowdin is a translation and localization management platform : http://crowdin.net/, (*2)

FYI, an official and more complete Ruby Client exists here : https://github.com/crowdin/crowdin-api, (*3)

Build Status Scrutinizer Quality Score, (*4)

Features

PSR-2 conventions and coding standard, (*5)

Wrap following API methods :, (*6)

  • Add a file, delete a file
  • Add a directory, delete a directory, change a directory
  • Update File, Upload translations, Upload fresh version of your localization file
  • Export Translations, Build fresh package with the latest translations.
  • Download Translations, Download last exported translation package (one language or all languages as one zip file).
  • Supported Languages, Get supported languages list with Crowdin codes mapped to locale name and standardized codes.
  • Translation Status, Track overall translation and proofreading progress of each target language.
  • Project Info, Shows project details and meta information.

Missing API methods https://github.com/akeneo/php-crowdin-api/issues?q=is%3Aopen+is%3Aissue+label%3Aapi-method, (*7)

Requirements

  • PHP >= 8.1
  • Docker for a better dev experience

How to use ?

Add the following lines in your project composer.json :, (*8)

{
    "require": {
        "akeneo/crowdin-api": "^2.0.0"
    },
    "minimum-stability": "stable"
}

Then, to instantiate the client and use available API methods :, (*9)

<?php
require 'vendor/autoload.php';

use 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();

Run tests

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

Use cases

You can take a look at following use cases to see more real life samples., (*10)

The Akeneo core team uses this library in Nelson, a command based translation workflow between Crowdin and GitHub (cf https://github.com/akeneo/nelson)., (*11)

The Sylius core team uses this library in SyliusBot to manage community translations https://github.com/SyliusBot/SyliusBot., (*12)

If you use this library don't hesitate to open a PR to explain your use case here :), (*13)

Licence

The MIT License (MIT), (*14)

Contribution

Feel free to fork and propose PR to complete missing API methods https://github.com/akeneo/php-crowdin-api/issues?q=is%3Aopen+is%3Aissue+label%3Aapi-method, (*15)

Any contributions are welcome!, (*16)

The Versions

18/11 2016

dev-master

9999999-dev https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

18/11 2016

1.0.0-alpha7

1.0.0.0-alpha7 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

19/09 2016

1.0.0-alpha6

1.0.0.0-alpha6 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

06/06 2016

1.0.0-alpha5

1.0.0.0-alpha5 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

03/05 2016

1.0.0-alpha4

1.0.0.0-alpha4 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

29/04 2016

1.0.0-alpha3

1.0.0.0-alpha3 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

30/03 2016

1.0.0-alpha2

1.0.0.0-alpha2 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

24/03 2016

1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

24/03 2016

0.3.0

0.3.0.0 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

14/03 2014

0.1.0

0.1.0.0 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin

14/03 2014

0.2.0

0.2.0.0 https://github.com/akeneo/php-crowdin-api

Crowdin PHP API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api translation localization crowdin