library sdk
The API client for openl10n
openl10n/sdk
The API client for openl10n
- Tuesday, November 3, 2015
- by MattKetmo
- Repository
- 2 Watchers
- 4 Stars
- 4,389 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 8 Forks
- 5 Open issues
- 4 Versions
- 6 % Grown
Openl10n SDK
, (*1)
Openl10n SDK is a PHP client for openl10n API.
It uses Guzzle library to handle HTTP requests., (*2)
Usage
<?php
require __DIR__.'/vendor/autoload.php';
use Openl10n\Sdk\Api;
use Openl10n\Sdk\Config;
use Openl10n\Sdk\Model\Resource;
$rootApi = new Api((new Config('openl10n.dev'))->setAuth('user', 'user'));
// Get API entry points
$projectApi = $rootApi->getEntryPoint('project');
$resourceApi = $rootApi->getEntryPoint('resource');
// Get project by its slug
$demo = $projectApi->get('demo');
// Create new resource file
$resource = new Resource($demo->getSlug());
$resource->setPathname('path/to/messages.en.yml');
$resourceApi->create($resource);
// Import some translations
$resourceApi->import($resource, 'path/to/messages.en.yml', 'en');
// Export content
$content = $resourceApi->export($resource, 'fr');
file_put_contents('path/to/messages.fr.yml', $content);
License
OpenLocalization SDK is released under the MIT License.
See the bundled LICENSE file for details., (*3)
dev-master
9999999-dev
The API client for openl10n
Sources
Download
MIT
The Requires
v0.2.0
0.2.0.0
The API client for openl10n
Sources
Download
MIT
The Requires
dev-guzzle5
dev-guzzle5
The API client for openl10n
Sources
Download
MIT
The Requires
The Development Requires