{"id":18719850,"url":"https://github.com/sc-networks/deepl-api-connector","last_synced_at":"2025-04-06T23:17:49.859Z","repository":{"id":32520763,"uuid":"134676146","full_name":"SC-Networks/deepl-api-connector","owner":"SC-Networks","description":"Connector library for deepl.com rest translation api","archived":false,"fork":false,"pushed_at":"2025-02-06T14:49:33.000Z","size":269,"stargazers_count":16,"open_issues_count":2,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-30T21:13:22.252Z","etag":null,"topics":["api","api-client","connector","deepl","deepl-api","deepl-client","i18n","php","translation","translations","translator"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SC-Networks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-24T07:12:40.000Z","updated_at":"2025-03-29T20:31:32.000Z","dependencies_parsed_at":"2024-06-18T16:44:09.938Z","dependency_job_id":"2804a6ec-d9f2-4441-b679-775b169c6331","html_url":"https://github.com/SC-Networks/deepl-api-connector","commit_stats":{"total_commits":57,"total_committers":8,"mean_commits":7.125,"dds":0.6666666666666667,"last_synced_commit":"aee805395337c64f8b2cf9efa5b03ff6f580569b"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC-Networks%2Fdeepl-api-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC-Networks%2Fdeepl-api-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC-Networks%2Fdeepl-api-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SC-Networks%2Fdeepl-api-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SC-Networks","download_url":"https://codeload.github.com/SC-Networks/deepl-api-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247563941,"owners_count":20958971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","connector","deepl","deepl-api","deepl-client","i18n","php","translation","translations","translator"],"created_at":"2024-11-07T13:28:13.719Z","updated_at":"2025-04-06T23:17:49.842Z","avatar_url":"https://github.com/SC-Networks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deepl-api-connector - Unofficial PHP Client for the API of deepl.com.\n\n[![Monthly Downloads](https://poser.pugx.org/scn/deepl-api-connector/d/monthly)](https://packagist.org/packages/scn/deepl-api-connector)\n[![License](https://poser.pugx.org/scn/deepl-api-connector/license)](LICENSE)\n[![Build status](https://github.com/SC-Networks/deepl-api-connector/actions/workflows/php.yml/badge.svg)](https://github.com/SC-Networks/deepl-api-connector/actions/workflows/php.yml)\n\n- Information about Deepl: https://www.deepl.com\n- Deepl API Documentation: https://www.deepl.com/api.html\n\nRequirements\n============\n\n- php (See the compatibility table below for supported php versions)\n- Implementations of [PSR17 (Http-Factories)](https://www.php-fig.org/psr/psr-17/) ([Available packages](https://packagist.org/providers/psr/http-factory-implementation)) and \n[PSR18 (Http-Client)](https://www.php-fig.org/psr/psr-18/) ([Available packages](https://packagist.org/providers/psr/http-client-implementation))\n- A deepl free/pro api key\n\nCompatibility\n=============\n\n| Connector-Version               | PHP-Version(s)          |\n|---------------------------------|-------------------------|\n| **master** (dev)                | 8.2, 8.3                |\n| **3.x** (features and bugfixes) | 7.4, 8.0, 8.1, 8.2, 8.3 |\n| **2.x** (EOL)                   | 7.3, 7.4, 8.0, 8.1      |\n| **1.x** (EOL)                   | 7.2, 7.3, 7.4           |\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require scn/deepl-api-connector\n```\n\n## Usage\n\n### Api client creation\n\nThe `DeeplClientFactory` supports auto-detection of installed psr17/psr18 implementations.\nJust call the `create` method and you are ready to go\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\nuse \\Scn\\DeeplApiConnector\\DeeplClientFactory;\n\n$deepl = DeeplClientFactory::create('your-api-key');\n```\n\nOptionally, you can provide already created instances of HttpClient, StreamFactory and RequestFactory as params to the create method.\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\nuse \\Scn\\DeeplApiConnector\\DeeplClientFactory;\n\n$deepl = DeeplClientFactory::create(\n    'your-api-key',\n    $existingHttpClientInstance,\n    $existingStreamFactoryInstance,\n    $existingRequestFactoryInstance,\n);\n```\n\n\nIf a custom HTTP client implementation is to be used, this can also be done via the DeeplClientFactory::create method.\nThe Client must support PSR18.\n\n\n#### Get Usage of API Key\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $usageObject = $deepl-\u003egetUsage();\n}\n```\n\n#### Get Translation\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $translation = new \\Scn\\DeeplApiConnector\\Model\\TranslationConfig(\n        'My little Test',\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE\n        ...,\n        ...,\n    );\n\n    $translationObject = $deepl-\u003egetTranslation($translation);\n}\n```\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $translation = new \\Scn\\DeeplApiConnector\\Model\\TranslationConfig(\n        'My little Test',\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE\n    );\n    \n    $translationObject = $deepl-\u003etranslate('some text', \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE);\n}\n```\n\nOptional you also can translate a batch of texts as once, see `example/translate_batch.php`\n\n#### Add File to Translation Queue\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $fileTranslation = new \\Scn\\DeeplApiConnector\\Model\\FileTranslationConfig(\n        file_get_contents('test.txt'),\n        'test.txt',\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_EN,\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE\n    );\n\n    $fileSubmission = $deepl-\u003etranslateFile($fileTranslation);\n\n    $fileSubmission-\u003egetDocumentId() \n}\n```\n\n#### Check File Translation Status\n\nAll translation states are available in `FileStatusEnum`\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $fileTranslation = new \\Scn\\DeeplApiConnector\\Model\\FileTranslationConfig(\n        file_get_contents('test.txt'),\n        'test.txt',\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_EN,\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE\n    );\n\n    $fileSubmission = $deepl-\u003etranslateFile($fileTranslation);\n\n    $translationStatus = $deepl-\u003egetFileTranslationStatus($fileSubmission);\n}\n```\n\n#### Get Translated File Content\n\n```php\nrequire_once __DIR__  . '/vendor/autoload.php';\n\n$deepl = \\Scn\\DeeplApiConnector\\DeeplClientFactory::create('your-api-key');\n\ntry {\n    $fileTranslation = new \\Scn\\DeeplApiConnector\\Model\\FileTranslationConfig(\n        file_get_contents('test.txt'),\n        'test.txt',\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_EN,\n        \\Scn\\DeeplApiConnector\\Enum\\LanguageEnum::LANGUAGE_DE\n    );\n\n    $fileSubmission = $deepl-\u003etranslateFile($fileTranslation);\n\n    $file = $deepl-\u003egetFileTranslation($fileSubmission);\n\n    echo $file-\u003egetContent();\n}\n```\n\n#### Retrieve supported languages\n\nSee `example/retrieve_supported_languages.php`\n\n#### Working with glossaries\n\nSee [use_glossaries.php](example/use_glossaries.php)\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Credits\n\n- [Deepl](https://www.deepl.com)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc-networks%2Fdeepl-api-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsc-networks%2Fdeepl-api-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsc-networks%2Fdeepl-api-connector/lists"}