PHPackages                             tetthys/search - 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. [Search &amp; Filtering](/categories/search)
4. /
5. tetthys/search

ActiveLibrary[Search &amp; Filtering](/categories/search)

tetthys/search
==============

Abstract, trait, and interface set for building extensible search services with A/C/D separation and testability.

0.0.1(8mo ago)036MITPHPPHP ^8.3

Since Sep 18Pushed 8mo agoCompare

[ Source](https://github.com/tetthys/search)[ Packagist](https://packagist.org/packages/tetthys/search)[ RSS](/packages/tetthys-search/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

tetthys/search
==============

[](#tetthyssearch)

> A lightweight PHP library for building **search services** with a clean A/C/D split:
>
> - **Action** → lifecycle (`search()` is the entrypoint)
> - **Calculation** → normalize input (`calcBuildQuery`)
> - **Data** → perform real I/O (`dataFetchReal`)

This separation makes your search logic **testable**, **reusable**, and **easy to extend**.

---

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

[](#installation)

```
composer require tetthys/search
```

---

Core Concepts
-------------

[](#core-concepts)

- **Action (A)** – `search()` orchestrates the lifecycle.
- **Calculation (C)** – `calcBuildQuery(mixed $input): array`→ pure, normalize raw input into a clean query array.
- **Data (D)** – `dataFetchReal(mixed $query, ?array $options = null): iterable`→ impure, execute the real I/O (database, API, filesystem).

> The abstract class already includes `QueryCaptureTestSupportTrait`, which provides helpers for capturing queries, faking fetchers, and overriding time.

---

Minimal Example
---------------

[](#minimal-example)

```
