PHPackages                             olegario/page-search-traits - 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. olegario/page-search-traits

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

olegario/page-search-traits
===========================

Library containing specialized pagination and search traits

v1.1.0(1y ago)0324[1 issues](https://github.com/Lorraine-Olegario/PageSearchTraits/issues)PHP

Since Mar 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Lorraine-Olegario/PageSearchTraits)[ Packagist](https://packagist.org/packages/olegario/page-search-traits)[ RSS](/packages/olegario-page-search-traits/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

PageSearchTraits
================

[](#pagesearchtraits)

Introducing PageSearchTraits, a library containing specialized pagination and search traits to improve the flexibility and efficiency of data access in PHP projects. Simplify your repository operations with robust functionality and easy integration.

The class uses Trait to extend its query capabilities. The added methods allow complex queries to be built, taking advantage of concepts such as field mapping and search operators.

Installation:
-------------

[](#installation)

```
composer require olegario/page-search-traits
```

Examples
--------

[](#examples)

```
class testRepository
{
    private PDO $conection;
    use Paginate;
    use PaginateRepository;
    use Search;
    use SearchRepository;

    protected array $fieldMap = [
        'status'       => 'teste_stts',
        'description'  => 'teste_dscrc',
        'number'       => 'teste_nmr',
    ];

    public function all(): array
    {
        $select = $this->conection->query("
             SELECT * FROM tabela
                {$this->sqlJoind()}
                {$this->sqlSearch()}
                {$this->sqlSearchOr()}
                {$this->sqlSearchOrConditions()}
                {$this->sqlOrderBy()}
                {$this->sqlGroupBy()}
                {$this->sqlPaginate()}
        ")->fetchAll(PDO::FETCH_ASSOC);
    }
}
```

The $fieldMap array plays a crucial role when mapping database table fields. It is used to ensure a consistent and safe approach when referencing fields, avoiding the direct use of field names and promoting a mapping practice.

```
protected array $fieldMap = [
        'status'       => 'teste_stts',
        'description'  => 'teste_dscrc',
        'number'       => 'teste_nmr',
];
```

Example serach usage: search by specific field using and, for each search field a new line must be added. Performs a detailed search on a specific field using operators such as 'like', '=', or 'in'.

```
$testRepository->search('number','like','%$searchNumber%');
$testRepository->search('number', '=', $searchNumber);
$testRepository->search('number', '', $searchNumber);
```

Example using serachOr: search for one or more specific fields using the or operator.

```
$testRepository->searchOR(['number', 'description'], 'like', $searchValue);
$testRepository->searchOR(['test'], '=', $searchValue);
```

Example using sqlSearchOrConditions: search condition with different values for each field.

```
$testRepository->searchORWithValues(
    ['number', 'description', 'number'],
    ['like', '=', '>'],
    ['%3%', 'report', '454']
)
```

Example of using orderBy

```
$testRepository->orderBy('number', 'asc');
```

Example of using groupBy: following the order of the fields.

```
$testRepository->groupBy(['status', 'commission']);
```

Example of using join.

```
$testRepository->join('INNER', 'commission_table', 'id', 'commission_id');
```

Example clears all values and criteria stored in the instance, allowing the same instance to be reused for a new query without interference from previous searches.

```
$testRepository->reset()
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Total

3

Last Release

524d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5da470adea81aa63efc4e4105e587eb75e82f07b32221830e4debef96bb9613b?d=identicon)[Lorraine-Olegario](/maintainers/Lorraine-Olegario)

---

Top Contributors

[![Lorraine-Olegario](https://avatars.githubusercontent.com/u/58961222?v=4)](https://github.com/Lorraine-Olegario "Lorraine-Olegario (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/olegario-page-search-traits/health.svg)

```
[![Health](https://phpackages.com/badges/olegario-page-search-traits/health.svg)](https://phpackages.com/packages/olegario-page-search-traits)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[handcraftedinthealps/zendsearch

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
