PHPackages                             mnemesong/spex - 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/spex

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

mnemesong/spex
==============

The package provides objects and an interface for express specifications.

0.8.1(3y ago)154MITPHPPHP &gt;=7.4

Since Aug 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mnemesong/spex)[ Packagist](https://packagist.org/packages/mnemesong/spex)[ RSS](/packages/mnemesong-spex/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependencies (6)Versions (20)Used By (0)

mnemesong/spex
==============

[](#mnemesongspex)

[![Latest Stable Version](https://camo.githubusercontent.com/9a5f40199caee974d2d1a08b69a3a4258d4d2dc5f70c3ae5882672e0424b0694/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f737065782f76)](https://packagist.org/packages/mnemesong/spex)[![PHPUnit](https://github.com/mnemesong/spex/actions/workflows/php-unit.yml/badge.svg)](https://github.com/mnemesong/spex/actions/workflows/php-unit.yml)[![PHPStan-lvl9](https://github.com/mnemesong/spex/actions/workflows/phpstan.yml/badge.svg)](https://github.com/mnemesong/spex/actions/workflows/phpstan.yml)[![PHP Version Require](https://camo.githubusercontent.com/b725e2d7b925fb1684a62c85c24b03ff6ed59b60c5d761228350607ed3563723/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f737065782f726571756972652f706870)](https://packagist.org/packages/mnemesong/spex)[![License](https://camo.githubusercontent.com/0809b3f043b1ca8a00cbf426fb4f8efd2a1f4aa7a35c38542c7e6a31307b8b0d/687474703a2f2f706f7365722e707567782e6f72672f6d6e656d65736f6e672f737065782f6c6963656e7365)](https://packagist.org/packages/mnemesong/spex)

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

---

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

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

### ENG:

[](#eng)

The package provides objects and an interface for expression of specifications (describes the conditions for fetching records from storage). For quick construction, use Sp::ex() builder.

### RUS:

[](#rus)

Пакет предоставляет объекты и интерфейс для выражения спецификаций (описывают услоние выборки записей из хранилища). Для быстрого построения используется билдер Sp::ex()

---

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

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

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

---

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

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

composer require "mnemesong/spex"

---

Specifications / Спецификации
-----------------------------

[](#specifications--спецификации)

### ENG:

[](#eng-1)

Specifications allow you to specify a condition for searching or selecting records, including logically complex ones.

#### Specifier Sp::ex

[](#specifier-spex)

The ex() method of class Sp allows you to quickly express any specification of various types. Its general syntax looks like as follows

`Sp::ex(, , );`

Additional type parameter depends on the specification type. There are several types of specifications:

#### Array comparison specifications

[](#array-comparison-specifications)

They have the general form: `Sp::ex(string , string ,     array )`

###### Types of array comparison specifications:

[](#types-of-array-comparison-specifications)

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

###### Example:

[](#example)

`Sp::ex("in", "age", [11, 22, 33, 44, 55])`

#### Table column comparison specifications

[](#table-column-comparison-specifications)

Have a general form: `Sp::ex(string , string , string )`

###### Table column comparison specification types:

[](#table-column-comparison-specification-types)

- `"cs="` - checks the equality of values in two columns of the same table row as strings (character by character)
- `"cs!="` - checks the inequality of values in two columns of the same table row as strings (character by character)
- `"cs>"`, `"cs!>"`, `"cs>="`, `"cs="`, `"cn"`, `"n!>"`, `"n>="`, `"n"`, `"s!>"`, `"s>="`, `"s"`, `"cs!>"`, `"cs>="`, `"cs="`, `"cn"`, `"n!>"`, `"n>="`, `"n"`, `"s!>"`, `"s>="`, `"s
