PHPackages                             qeti/yii2-podata-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. qeti/yii2-podata-adapter

ActiveLibrary[HTTP &amp; Networking](/categories/http)

qeti/yii2-podata-adapter
========================

Adapter for using POData with Yii2

v0.9(10y ago)11.3k3MITPHPPHP &gt;=5.4.0

Since Sep 26Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Qeti/Yii2PODataAdapter)[ Packagist](https://packagist.org/packages/qeti/yii2-podata-adapter)[ Docs](https://github.com/qeti/Yii2PODataAdapter#readme)[ RSS](/packages/qeti-yii2-podata-adapter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Adapter POData-Yii2
===================

[](#adapter-podata-yii2)

What is this?
----------------------------------------------

[](#what-is-this-)

Adapter for using [OData](http://www.odata.org/) in [Yii2](http://www.yiiframework.com) with library [POData](https://github.com/POData/POData).

### Who is using it?

[](#who-is-using-it)

- It's instrument for developers, who using [Yii2 framework](http://www.yiiframework.com).

Installation
-----------------------------------------------------

[](#installation-)

[PHP 5.4 or higher](http://www.php.net/downloads.php) is required to use it. [Yii2 framework](http://www.yiiframework.com) is required to use it.

Installation is recommended to be done via [composer](https://getcomposer.org/ "The PHP package manager"). Add the following to the `require` and `repositories` sections in `composer.json` of Yii2 project:

```
    "require": {
       "qeti/simple-podata": ">=0.9.1"
    }
```

Run `composer update` afterwards.

Usage
---------------------------------------

[](#usage-)

### In your basic Yii2 project

[](#in-your-basic-yii2-project)

Add the following to the configuration file `web.php`:

```
    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                ['class' => 'qeti\Yii2PODataAdapter\ODataUrlRule'],
            ],
        ],
    ],
    'controllerMap' => [
        'o-data' => 'qeti\Yii2PODataAdapter\implementation\ODataController',
    ],
```

Set up class map for MetaProvider:

```
yii::$classMap['qeti\Yii2PODataAdapter\implementation\MetadataProvider'] = '@app/models/OData/MetadataProvider.php';
```

Create classes, what describe entities, for example:

```
namespace app\models\OData\Entities;

use yii\db\ActiveRecord;
use qeti\SimplePOData\EntityTrait;

class Request extends ActiveRecord {

    use EntityTrait;

    public $id;
    public $type_code;
    public $status_code;
}
```

Create MetaProvider class, what describe all entities for POData, for example:

```
namespace qeti\Yii2PODataAdapter\implementation;

use POData\Providers\Metadata\Type\EdmPrimitiveType;
use POData\Providers\Metadata\SimpleMetadataProvider;

class MetadataProvider
{
    const MetaNamespace = "Data";

    /**
     * @return IMetadataProvider
     */
    public static function create()
    {
        $metadata = new SimpleMetadataProvider('Data', self::MetaNamespace);

        $requestEntityType = self::createRequestEntityType($metadata);
        $requestResourceSet = $metadata->addResourceSet('Requests', $requestEntityType);

        return $metadata;
    }

    private static function createRequestEntityType(SimpleMetadataProvider $metadata)
    {
        $et = $metadata->addEntityType(new \ReflectionClass('app\models\OData\Entities\Request'), 'Requests', self::MetaNamespace);
        $metadata->addKeyProperty($et, 'id', EdmPrimitiveType::INT64);
        $metadata->addPrimitiveProperty($et, 'type_code', EdmPrimitiveType::STRING);
        $metadata->addPrimitiveProperty($et, 'status_code', EdmPrimitiveType::STRING);
        return $et;
    }

}
```

Try to open links:

- http:///odata.svc/$metadata
- http:///odata.svc/Requests?$format=json&amp;$skip=1&amp;$top=14&amp;$inlinecount=allpages&amp;$filter=status\_code eq 'held'
- http:///odata.svc/Requests/$count?&amp;$filter=status\_code eq 'held'
- http:///odata.svc/Requests(2465)

For more details about URL format, see [OData documentation](http://www.odata.org/documentation/odata-version-2-0/uri-conventions/).

### Am I free to use this?

[](#am-i-free-to-use-this)

This library is open source and licensed under the [MIT License](http://opensource.org/licenses/MIT). This means that you can do whatever you want with it as long as you mention my name and include the [license file](https://github.com/qeti/Yii2PODataAdapter/blob/master/LICENSE). Check the [license](https://github.com/qeti/Yii2PODataAdapter/blob/master/LICENSE) for details.

Contact
-------

[](#contact)

Feel free to contact me using [email](mailto:mnvx@yandex.ru).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3927d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bac4bded42026d8fd5726df11002c08442b34b40eed209223a73a784a559f34?d=identicon)[mnvx](/maintainers/mnvx)

---

Top Contributors

[![mnvx](https://avatars.githubusercontent.com/u/829880?v=4)](https://github.com/mnvx "mnvx (5 commits)")

---

Tags

restyii2odatapodata

### Embed Badge

![Health badge](/badges/qeti-yii2-podata-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/qeti-yii2-podata-adapter/health.svg)](https://phpackages.com/packages/qeti-yii2-podata-adapter)
```

###  Alternatives

[zhuravljov/yii2-rest

Yii2 REST Client

1186.2k](/packages/zhuravljov-yii2-rest)[tunecino/yii2-nested-rest

Adds nested resources routing support along with related actions and relationship handlers to the Yii RESTful API framework

4716.0k](/packages/tunecino-yii2-nested-rest)[algo-web/podata

OData for Poor PHP Developers

2812.7k3](/packages/algo-web-podata)[nostop8/rest-api-doc

Simple documentation generator for Yii2 REST applications based on defined API endpoints and actions annotations.

1919.9k](/packages/nostop8-rest-api-doc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
