I am new to yii and i have to create a yii component for Enom api .I have followed this url Enom application for refrence . It is in core php and i want to implement this in yii as component or module .I have done in this way
put the files interface and class in the yii component folder.
modify the class as mentioned here yii custom component . Now my class name is
EnomService
and interface name isEnomInterface
i have added these lines also in my classuse Yii; use yii\base\Component; use yii\base\InvalidConfigException;
modified the
main.php
file in config folder:'import'=>array( 'application.models.*', 'application.components.*', ), 'defaultController'=>'post', // application components 'components'=>array( 'user'=>array( // enable cookie-based authentication 'allowAutoLogin'=>true, ), 'mycomponent' => [ 'class' => 'app\components\EnomService', ],
calling in the controller in this way .
public function actionEnom () { echo "asdgsgsag"; $enom = new EnomService('manoj_rudra', 'manoj@41@', false, true); $enom->debug = true; $result= Yii::$app->EnomService->checkDomain('systurn', 'com', true); //$result = $enom->checkDomain('systurn', 'com', true); // This enables domain spinner echo '<pre>'; var_dump($result); echo '</pre>'; }
But it is not working . I am not so much familiar with yii custom component . Please help me to create this .