PHPackages                             saidmix01/criteria-filter - 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. saidmix01/criteria-filter

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

saidmix01/criteria-filter
=========================

Una librería de ejemplo en PHP

v1.0.0(1y ago)32MITPHP

Since Feb 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/saidmix01/criteria-filter)[ Packagist](https://packagist.org/packages/saidmix01/criteria-filter)[ RSS](/packages/saidmix01-criteria-filter/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Product Filter Library in PHP using Criteria Method
===================================================

[](#product-filter-library-in-php-using-criteria-method)

This project is an example of how to implement a product filter in PHP using the criteria method. The code retrieves data from a fake product API and filters it according to the parameters provided in the URL.

Description
-----------

[](#description)

The project consists of a PHP class `FilterWithCriteria` that filters product data based on various criteria such as sorting, filtering by value, and limiting the number of results.

Features
--------

[](#features)

- Filter products based on parameters provided in the URL.
- Sort products by specified fields in ascending or descending order.
- Limit the number of results and apply an offset.

Usage
-----

[](#usage)

To use this library, you need to include the `FilterWithCriteria.php` file in your project and create an instance of the `FilterWithCriteria` class. You can then call the `search` method with the data and parameters to filter the products.

### Example URL

[](#example-url)

[http://localhost/index.php?query\[orderBy\]=code&amp;query\[order\]=asc&amp;query\[limit\]=10&amp;query\[offset\]=0&amp;query\[param\]=price&amp;query\[value\]=10&amp;query\[operator\]=greater](http://localhost/index.php?query%5BorderBy%5D=code&query%5Border%5D=asc&query%5Blimit%5D=10&query%5Boffset%5D=0&query%5Bparam%5D=price&query%5Bvalue%5D=10&query%5Boperator%5D=greater)

### Parameters

[](#parameters)

- `orderBy`: The field by which the data should be ordered.
- `order`: The order direction (`asc` for ascending, `desc` for descending).
- `limit`: The maximum number of results to return.
- `offset`: The number of results to skip before starting to collect the result set.
- `param`: The field to filter by.
- `value`: The value to filter by.
- `operator`: The operator to use for filtering (`equals`, `between`, `greater`, `less`).

Code Overview
-------------

[](#code-overview)

### Class: FilterWithCriteria

[](#class-filterwithcriteria)

#### Methods

[](#methods)

- `search($data = [], $params = [])`: Handles the main logic of retrieving and filtering the products, and returns the response as a JSON string.
- `filter($data, $params)`: Filters an array of data based on specified parameters such as sorting, filtering by value, and limiting the number of results.
- `get_params($params)`: Extracts and returns specific parameters from an array input.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance40

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

503d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/83876933?v=4)[Said Andrés Avendaño Lozano](/maintainers/saidmix01)[@saidmix01](https://github.com/saidmix01)

---

Top Contributors

[![saidmix01](https://avatars.githubusercontent.com/u/83876933?v=4)](https://github.com/saidmix01 "saidmix01 (7 commits)")

### Embed Badge

![Health badge](/badges/saidmix01-criteria-filter/health.svg)

```
[![Health](https://phpackages.com/badges/saidmix01-criteria-filter/health.svg)](https://phpackages.com/packages/saidmix01-criteria-filter)
```

###  Alternatives

[motomedialab/laravel-vite-helper

A helper method to generate absolute asset URL's to Vite assets

30587.0k2](/packages/motomedialab-laravel-vite-helper)

PHPackages © 2026

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