PHPackages                             mnemesong/fit - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mnemesong/fit

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

mnemesong/fit
=============

The package provides objects and an interface for build match conditions.

0.1.1(3y ago)1321MITPHPPHP &gt;=7.4

Since Aug 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mnemesong/fit)[ Packagist](https://packagist.org/packages/mnemesong/fit)[ RSS](/packages/mnemesong-fit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (1)

mnemesong/fit
=============

[](#mnemesongfit)

[![Latest Stable Version](https://camo.githubusercontent.com/530aa51057bd349fbe71ff611c6b76df8269cb93f1ff5444672d751ff8674cc1/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f6669742f76)](https://packagist.org/packages/mnemesong/fit)[![PHPUnit](https://github.com/mnemesong/fit/actions/workflows/phpunit.yml/badge.svg)](https://github.com/mnemesong/fit/actions/workflows/phpunit.yml)[![PHPStan-lvl9](https://github.com/mnemesong/fit/actions/workflows/phpstan.yml/badge.svg)](https://github.com/mnemesong/fit/actions/workflows/phpstan.yml)[![PHP Version Require](https://camo.githubusercontent.com/81fe8b5ac5009518ff2e283315c7997bcbe6e8deb977c4a13c069a61096b34e0/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f6669722f726571756972652f706870)](https://packagist.org/packages/mnemesong/fit)[![License](https://camo.githubusercontent.com/72638c119e7a6cbdd37059d83bf192f34c28dbd4a52998593a554e15f4a7111d/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f6669742f6c6963656e7365)](https://packagist.org/packages/mnemesong/fit)

- The documentation is written in two languages: Russian and English.
- Документация написана на двух языках: русском и английском.

---

General description / Общее описание
------------------------------------

[](#general-description--общее-описание)

### RUS:

[](#rus)

Пакет предоставляет объекты и интерфейс для выражения условий поиска (описывают услоние выборки записей из хранилища). Для быстрого построения используется билдер Fit (например Fit::field('name')-&gt;val('=', 'John'))

---

Requirements / Требования
-------------------------

[](#requirements--требования)

- PHP &gt;= 7.4
- Composer &gt;=2.0

---

Installation / Установка
------------------------

[](#installation--установка)

composer require "mnemesong/fit"

---

Conditions / Условия
--------------------

[](#conditions--условия)

### RUS:

[](#rus-1)

Выразитель условий поиска Fit позволяет быстро выражать любые условия поиска различных типов.

---

Field with array comparing fits / Сравнение значений поля таблицы с массивом
----------------------------------------------------------------------------

[](#field-with-array-comparing-fits--сравнение-значений-поля-таблицы-с-массивом)

### ENG:

[](#eng)

They have the general form: `Fit::field(string )->arr(string , array )`

###### Allowed operators for array comparison:

[](#allowed-operators-for-array-comparison)

- `"in"` - checks whether the value in the column is included in the comparison array
- `"!in"` - checks if the value in the column is not included in the comparison array

###### Example:

[](#example)

`Fit::field("age")->arr("in", [11, 22, 33, 44, 55])`

### RUS:

[](#rus-2)

Имеют общий вид: `Fit::field(string )->arr(string , array )`

###### Допустимые операторы для сравнения с массивом:

[](#допустимые-операторы-для-сравнения-с-массивом)

- `"in"` - проверяет вхождение значения в колонке в массив сравнения
- `"!in"` - проверяет отсутствие вхождения значения в колонке в массив сравнения

###### Пример:

[](#пример)

`Fit::field("age")->arr("in", [11, 22, 33, 44, 55])`

---

Fields comparing fits / Сравнение колонок таблицы
-------------------------------------------------

[](#fields-comparing-fits--сравнение-колонок-таблицы)

### ENG:

[](#eng-1)

They have a general form: `Fit::field(string )->field(string , string )`

###### Allowed operators for comparing table columns:

[](#allowed-operators-for-comparing-table-columns)

- `"="` - checks the equality of values in two columns of the same table row
- `"!="` - checks the inequality of values in two columns of the same table row
- `">"`, `"!>"`, `">="`, `"", "index")->asNum()`

### RUS:

[](#rus-3)

Имеют общий вид: `Fit::field(string )->field(string , string )`

###### Допустимые операторы для сравнения колонок таблицы:

[](#допустимые-операторы-для-сравнения-колонок-таблицы)

- `"="` - проверяет равенство значений в двух колонках одной строки таблицы
- `"!="` - проверяет неравенство значений в двух колонках одной строки таблицы
- `">"`, `"!>"`, `">="`, `"", "index")->asNum()`

---

Field with scalar val comparing / Сравнение поля cо скалярным значением
-----------------------------------------------------------------------

[](#field-with-scalar-val-comparing--сравнение-поля-cо-скалярным-значением)

### ENG:

[](#eng-2)

They have the general form: `Fit::field(string )->val(string , string )`

###### Allowed operators to compare against a scalar value:

[](#allowed-operators-to-compare-against-a-scalar-value)

- `"="` - checks for equality (NULL-safe) of the column value with the specified string value
- `"!="` - checks if the (NULL-safe) value of the column with the specified string value is not equal
- `">"`, `"!>"`, `">="`, `""`, `"!>"`, `">="`, `"
