justmd5 / deeplx
deeplx is a simple and fast free deepl library for PHP.
v1.7.0
2024-08-29 03:38 UTC
Requires
- php: >=7.2||8.*
- ext-curl: *
- ext-json: *
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- jetbrains/phpstorm-attributes: ^1.0
- laravel/pint: ^1.10
- mockery/mockery: ^1.2
- phpunit/phpunit: ^9.0
- vimeo/psalm: ^4.10
README
deeplx is a simple and fast free deepl library for PHP.
Installing
$ composer require justmd5/deeplx -vvv
Usage
<?php require __DIR__.'/vendor/autoload.php'; $deeplx=new \Justmd5\DeeplX\DeepLTranslator(); try { //translate chinese to english var_dump($deeplx->zh2en("你好")); //output: // array(4) { // ["status"]=> // int(1000) // ["code"]=> // int(1000) // ["message"]=> // string(2) "ok" // ["data"]=> // string(12) "How are you?" // } //translate english to chinese var_dump($deeplx->en2zh("hello my friend.")); //output: //array(4) { // ["status"]=> // int(1000) // ["code"]=> // int(1000) // ["message"]=> // string(2) "ok" // ["data"]=> // string(24) "你好,我的朋友。" //} //normal translate func demo $result = $translator->translate('hello', 'ja')->result(); var_dump($result); //output: //array(4) { // ["status"]=> // int(1000) // ["code"]=> // int(1000) // ["message"]=> // string(2) "ok" // ["data"]=> // string(12) "こんにちわ" //} } catch (Exception $e) { var_dump($e); }
without verify
\Justmd5\DeeplX\DeepLTranslator::withoutVerifying()->en2zh('hello');
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT