chiarillomax / yandex-translator-bundle
Yandex 译者在 Symfony2 中的集成
V1.2
2016-04-20 13:25 UTC
Requires
- guzzle/guzzle: ^3.9
- symfony/framework-bundle: ~2.3
Requires (Dev)
- phpunit/phpunit: ^4.7
This package is not auto-updated.
Last update: 2024-09-25 23:24:10 UTC
README
在您的 Symfony 项目中使用 Yandex 译者服务
安装
安装捆绑包
composer require chiarillomax/yandex-translator-bundle
在 app/AppKernel.php
中注册捆绑包
<?php // app/AppKernel.php public function registerBundles() { return array( // ... new \Yandex\TranslatorBundle\YandexTranslatorBundle() ); }
使用
//use Yandex\TranslatorBundle\Model\Key $key = new Key(); $key->setValue('YourKey'); $request = $this->get('yandex.translator')->createRequest() ->setKey($key->getValue()) ->setText('Hello Max') ->setFrom('en') ->setTo('it') ->send(); $text = $request->getText(); //Ciao Max
测试
phpunit