PHPackages                             aros/omnifetch-phalcon - 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. aros/omnifetch-phalcon

ActiveLibrary

aros/omnifetch-phalcon
======================

Phalcon Fetching Library for simplifying fetch API endpoints

56712PHP

Since Aug 24Pushed 7y ago2 watchersCompare

[ Source](https://github.com/lordrah/omnifetch-phalcon)[ Packagist](https://packagist.org/packages/aros/omnifetch-phalcon)[ RSS](/packages/aros-omnifetch-phalcon/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

OmniFetch for Phalcon
=====================

[](#omnifetch-for-phalcon)

> OmniFetch for Phalcon is useful library that would suit most of your fetching API endpoint needs. It helps you in fetching row(s) of data based on a particular model and attach data from other related models easily. It also allows for complex filter conditions using combinations of **AND** and **OR** Boolean operators and the use of **LIKE**, **IS** and **IS NOT** comparison operators with pagination.

[![Total Downloads](https://camo.githubusercontent.com/5414305ffa6533cd75a37b5c3c5243ab000765b2d2541c1fca58250aa6415e18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61726f732f6f6d6e6966657463682d7068616c636f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aros/omnifetch-phalcon)

Dependencies
------------

[](#dependencies)

- Installed Phalcon &lt;= 2.1.0
- For the library to work properly, the relationships between Models need to be set up fully.

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

[](#installation)

The preferred way to install this extension is through [Composer](https://getcomposer.org)

```
$ composer require aros/omnifetch-phalcon
```

Another alternative is to simply add the following line to the require block of your `composer.json` file.

```
"aros/omnifetch-phalcon": "dev-master"

```

Then run `composer install` or `composer update` to download it and have the autoloader updated.

Public Methods
--------------

[](#public-methods)

- **getAll**(string **$main\_model**, array **$params**, array **$settings**)
- **getOne**(string **$main\_model**, array **$params**, array **$settings**)

Parameters
----------

[](#parameters)

These are the valid keys allowed in **$params** (which is an input parameter in the public methods). This is the The available ones are as follows:

- **embeds** - This is an array containing the alias of the main model's relations which is to be attached to the main model's data in the result.
- **filters** - This is an array containing filtering conditions using in fetching data. The conditions are handled and combined in the order they are in the array. Each condition is array in itself which contain the following:
    - **field** - This indicates the column to be used for the filtering. **Please note:** The model's alias **must** be used in the name of this column e.g. `Card.id`. The field using here can also be that of a related model to the main model. For example, if `Issuer` is a related model to `Card`, `Issuer.name` can be used to filter.
    - **value** - This indicates the value of the field to be used for the filtering.
    - **cmp** (optional) - This represents the comparison operator to be used. By default, it is `=`. This can be `>`, `=`, `
