PHPackages                             lune/osmosis - 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. lune/osmosis

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

lune/osmosis
============

A filtering api

v0.0.1(9y ago)013MITPHPPHP &gt;=7.0

Since Jan 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/lunephp/osmosis)[ Packagist](https://packagist.org/packages/lune/osmosis)[ RSS](/packages/lune-osmosis/feed)WikiDiscussions master Synced 2mo ago

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

Osmosis
=======

[](#osmosis)

A fluent interface for filtering data.

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

[](#installation)

The (highly) recommended way to install Osmosis is by using [Composer](https://getcomposer.org/)

```
composer require lune/osmosis
```

Operators
---------

[](#operators)

The following operators are available:

equals

inArray

greaterThan

greaterThanOrEqual

lessThan

lessThanOrEqual

not

notInArray

DataSources
-----------

[](#datasources)

The following DataSources are bundled:

### ArrayDataSource

[](#arraydatasource)

Wraps an array and filters it

```
$filter = new Lune\Osmosis\Filter()
$filter
    ->equals('a', 1)
    ->greaterThan('b', 100);

$array = [
    ['a'=>1, 'b'=>20],
    ['a'=>1, 'b'=>120],
    ['a'=>3, 'b'=>120]
];

//Convert our array to a DataSourceInterface object
$source = new Lune\Osmosis\DataSource\ArrayDataSource($array);

//Apply the filter to our datasource
$result = $filter->apply($source);

print_r((array) $result);
//[['a'=>1, 'b'=>'120']];
```

### SQLDataSource

[](#sqldatasource)

Creates partial sql:

```
$filter = new Lune\Osmosis\Filter()
$filter->equals('ID', 1);

$source = new Lune\Osmosis\DataSource\SQLDataSource();
$result = $filter->apply($source);

//Execution example
$pdo = new \PDO(...);
$statement = $pdo->prepare("SELECT * FROM `users` WHERE {$result}");
$statement->execute($result->getVariables())->fetchAll();
```

**Please note**Osmosis is by no means a complete query builder, nor does it aim to be one.

Defining filters
----------------

[](#defining-filters)

To add filters, simply use the methods provided:

```
$filter = new Lune\Osmosis\Filter()
$filter
    ->equals('a', 1)
    ->greaterThan('b', 100);
```

You can also use a callable as the constructor parameter:

```
$filter = new Lune\Osmosis\Filter(function(FilterInterface $f){
        $f->equals('a', 1)->greaterThan('b', 100);
});
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3407d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b57a4311f92e06e73f6c646344a069d0088747f22e420a583f91bd3e6ab1729?d=identicon)[studiowbe](/maintainers/studiowbe)

---

Top Contributors

[![willemwollebrants](https://avatars.githubusercontent.com/u/916958?v=4)](https://github.com/willemwollebrants "willemwollebrants (22 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lune-osmosis/health.svg)

```
[![Health](https://phpackages.com/badges/lune-osmosis/health.svg)](https://phpackages.com/packages/lune-osmosis)
```

###  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)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

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

PHPackages © 2026

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