/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/components/OpenRouteComponent.php
56 строк
1 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\components; use common\helpers\ArrayHelper; use fholbrook\Openrouter\OpenRouter; use fholbrook\Openrouter\OpenRouterConfig; use yii\base\Component; use Yii; use yii\helpers\VarDumper; /** * Компонент для работы с OpenRouter * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2019-2025 */ class OpenRouteComponent extends Component { /** * Клиент для работы с OpenRouter * @var OpenRouter */ protected $client = null; /** * @inheritdoc */ public function init() { parent::init(); // TODO: Change the autogenerated stub $config = ArrayHelper::getValue(Yii::$app->params, 'OpenRoute'); Yii::debug(VarDumper::dumpAsString([ 'config' => $config ])); $apiKey = ArrayHelper::getValue($config, 'api_key'); $this->client = new OpenRouter( new OpenRouterConfig( apiKey: $apiKey ) ); } /** * Получить экземпляр клиента для работы * @return OpenRouter|null */ public function getClient() { return $this->client; } }