Download the PHP package rasuvaeff/specification without Composer

On this page you can find all versions of the php package rasuvaeff/specification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package specification

rasuvaeff/specification

Latest Stable Version Total Downloads Build Static analysis Psalm level PHP Русская версия

Specification pattern for building Yiisoft DB queries.

Using an AI coding assistant? llms.txt is a compact, self-contained reference of the whole public API plus copy-paste recipes — drop it into the model's context. Contributors: see AGENTS.md. Projects using the llm/skills Composer plugin also get this package's agent skill synced into .agents/skills/ automatically on install.

Requirements

Installation

Usage

SpecificationBuilder

Fluent builder for composing query conditions:

Available methods:

Method SQL equivalent
where($col, $val, $op) col op val (any operator)
whereEqual($col, $val) col = val
whereNotEqual($col, $val) col != val
whereGreaterThan($col, $val) col > val
whereGreaterThanOrEqual($col, $val) col >= val
whereLessThan($col, $val) col < val
whereLessThanOrEqual($col, $val) col <= val
whereIn($col, $values) col IN (values)
whereNotIn($col, $values) col NOT IN (values)
whereLike($col, $pattern) col LIKE pattern
whereNotLike($col, $pattern) col NOT LIKE pattern
whereBetween($col, $from, $to) col BETWEEN from AND to
whereNotBetween($col, $from, $to) col NOT BETWEEN from AND to
whereIlike($col, $pattern) col ILIKE pattern
whereNotIlike($col, $pattern) col NOT ILIKE pattern
whereStartsWith($col, $prefix) col LIKE prefix%
whereEndsWith($col, $suffix) col LIKE %suffix
whereContains($col, $substring) col LIKE %substring%
whereNull($col) col IS NULL
whereNotNull($col) col IS NOT NULL
orWhere(callable) OR (nested conditions)
notWhere(callable) NOT (nested conditions)
orderBy($columns) ORDER BY col [ASC\|DESC]
limit($n) LIMIT n
offset($n) OFFSET n

Specifications

Building blocks for composing complex conditions:

ComparisonSpecification factory methods

Custom visitor

Implement SpecificationVisitor<T> to traverse the specification tree:

Examples

Runnable, offline examples (in-memory SQLite) live in examples/: builder.php (AND/IN/BETWEEN) and or-not-raw.php (OR/NOT/raw/order+limit).

Security

Performance

SpecificationBuilder is immutable — each where*(), limit(), and offset() call clones the builder before returning. This is safe and predictable but carries a small overhead (~3.3µs for a 7-step chain, vs ~2.4µs for direct CompositeSpecification composition). orWhere() additionally allocates a temporary builder and invokes a closure (~2.8µs vs ~1.4µs for direct OrSpecification::create()).

For most web request workloads (1–5 specs per request, DB queries taking 1–100ms) this overhead is negligible. For high-throughput batch processing where specs are built in a tight loop, prefer the direct CompositeSpecification API:

Benchmarks live in benchmarks/ and run via composer bench (requires testo/bench).

Notes

License

BSD-3-Clause.


All versions of specification with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
ext-mbstring Version *
yiisoft/db Version ^2.0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/specification contains the following files

Loading the files please wait ...