2017 © Pedro Peláez
 

yii2-extension yii2-restclient

Tools to use API as ActiveRecord for Yii2

image

apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  • Wednesday, November 15, 2017
  • by ApexWire
  • Repository
  • 3 Watchers
  • 13 Stars
  • 1,925 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 9 Open issues
  • 9 Versions
  • 4 % Grown

The README.md

Yii2 Rest Client

Инструменты для использования API, как ActiveRecord для Yii2, (*1)

Используйте свой API как ActiveRecord, (*2)

Установка

Предпочтительный способ установки расширения через composer., (*3)

Запустить, (*4)

php composer.phar require "apexwire/yii2-restclient"

или добавить, (*5)

"apexwire/yii2-restclient": "*"

в разделе "require" вашего composer.json, (*6)

Конфигурация

Добавьте этот код в ваш файл конфигурации:, (*7)

    'components' => [
        'restclient' => [
            'class' => 'apexwire\restclient\Connection',
            'config' => [
                'base_uri' => 'https://api.site.com/',
            ],
        ],
    ],

Применение

Определите свою модель, (*8)

class MyModel extends \apexwire\restclient\ActiveRecord
{
    public function attributes()
    {
        return ['id', 'name', 'status'];
    }
}

Debug

Пример подключения debug панели, (*9)

$config['modules']['debug'] = [
    'class' => 'yii\debug\Module',
    'panels' => [
        'rest' => ['class' => 'apexwire\restclient\DebugPanel'],
    ],
];

Возможности

  • можно указать список полей, которые вернутся: MyModel::find()->select(['id','name'])
  • можно указать лимит: MyModel::find()->limit(2)
  • поддерживается пагинация
  • поддерживается сортировка
  • поддерживается поиск. Пример тут.

Лицензия

Этот проект был выпущен под лицензией BSD-3-Clause. Подробнее тут., (*10)

Copyright © 2016, ApexWire, (*11)

Выражение признательности

  • Проект основан на расширении Yii2 HiArt.

The Versions

15/11 2017

dev-dev

dev-dev https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

21/04 2017

dev-master

9999999-dev https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

21/04 2017

0.4.3

0.4.3.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

05/04 2017

0.4.2

0.4.2.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

27/12 2016

0.4.1

0.4.1.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

18/11 2016

0.4

0.4.0.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

23/09 2016

0.3

0.3.0.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

17/03 2016

0.2

0.2.0.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord

11/03 2016

0.1

0.1.0.0 https://github.com/apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar ApexWire

api extension yii2 activerecord