akeneo/crowdin-api
Composer 安装命令:
composer require akeneo/crowdin-api
包简介
Crowdin PHP API client
README 文档
README
A simple PHP Crowdin API client http://crowdin.net/page/api.
Crowdin is a translation and localization management platform : http://crowdin.net/
FYI, an official and more complete Ruby Client exists here : https://github.com/crowdin/crowdin-api
Features
PSR-2 conventions and coding standard
Wrap following API methods :
- 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
Requirements
- PHP >= 8.1
- Docker for a better dev experience
How to use ?
Add the following lines in your project composer.json :
{ "require": { "akeneo/crowdin-api": "^2.0.0" }, "minimum-stability": "stable" }
Then, to instantiate the client and use available API methods :
<?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.
The Akeneo core team uses this library in Nelson, a command based translation workflow between Crowdin and GitHub (cf https://github.com/akeneo/nelson).
The Sylius core team uses this library in SyliusBot to manage community translations https://github.com/SyliusBot/SyliusBot.
If you use this library don't hesitate to open a PR to explain your use case here :)
Licence
The MIT License (MIT)
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
Any contributions are welcome!
akeneo/crowdin-api 适用场景与选型建议
akeneo/crowdin-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 151.37k 次下载、GitHub Stars 达 34, 最近一次更新时间为 2014 年 01 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「translation」 「api」 「localization」 「crowdin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 akeneo/crowdin-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 akeneo/crowdin-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 akeneo/crowdin-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Package for convenient work with Laravel's localization features
Field for number with restricted count of digits and decimal places
A custom URL rule class for Yii 2 which allows to create translated URL rules
A Laravel Eloquent model trait for translatable resource
Deepl Automated translations for Laravel lang files
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 151.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 35
- 点击次数: 27
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-01-05