artyomnar94/rest-api-client

wrapper on yii2-httplcient for work with WP Core API

v2.0 2021-05-03 11:24 UTC

This package is auto-updated.

Last update: 2024-04-27 23:31:17 UTC


README

Wrapper on WP Core Api

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

composer require artyomnar/yii2-core-api-client

or add

"artyomnar/yii2-core-api-client": "*"

to the require section of your composer.json.

Settings

  • Set in yii-app as component:
  'coreApiClient' => [
    'class' => 'artyomnar\CoreApiClient\CoreApi',
    'coreHost' => YII_ENV_PROD? 'https://api-app.com/v1/' : 'https://test.api-app.com/v1/'    
  ],

Usage

$loginForm = new LoginForm();
if ($loginForm->load(Yii::$app->request->post()) && $loginForm->validate()) {
    $userData = Yii::$app->coreApiClient->user->auth($loginForm);
    $userEntity = new User($userData);
}