PHPackages                             agog/osmose - 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. [Database &amp; ORM](/categories/database)
4. /
5. agog/osmose

ActiveLibrary[Database &amp; ORM](/categories/database)

agog/osmose
===========

Elegant filtering for laravel's eloquent models

3.0.0(1y ago)4711.6k↓33.3%11MITPHP

Since Sep 12Pushed 1y ago3 watchersCompare

[ Source](https://github.com/franciskisiara/osmose)[ Packagist](https://packagist.org/packages/agog/osmose)[ RSS](/packages/agog-osmose/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (21)Used By (1)

Osmose Eloquent Filter
======================

[](#osmose-eloquent-filter)

[![Build Status](https://camo.githubusercontent.com/9361b38206fe837103082ed6992ee4fb7aada9d06bda7fa19f1dd137035b9b1c/68747470733a2f2f7472617669732d63692e6f72672f6672616e6369736b6973696172612f6f736d6f73652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/franciskisiara/osmose)[![Latest Stable Version](https://camo.githubusercontent.com/5cd6cc09cb812082697f6043210487f9be765020699314f819c5ca30bf7ebfac/68747470733a2f2f706f7365722e707567782e6f72672f61676f672f6f736d6f73652f762f737461626c65)](https://packagist.org/packages/agog/osmose)[![Total Downloads](https://camo.githubusercontent.com/23747789ac9ae7339a52e12be37b06a18cafb88fa24336d566e9e37d78c7044d/68747470733a2f2f706f7365722e707567782e6f72672f61676f672f6f736d6f73652f646f776e6c6f616473)](https://packagist.org/packages/agog/osmose)[![License](https://camo.githubusercontent.com/4ca0d61f5e237dcac5eaf2e339f0a960bbe03fcc006ce8c084788a8170cb0a21/68747470733a2f2f706f7365722e707567782e6f72672f61676f672f6f736d6f73652f6c6963656e7365)](https://packagist.org/packages/agog/osmose)

An elegant way to filter your eloquent collections

Getting Started
---------------

[](#getting-started)

To pull osmose in your project, use the command

```
composer require agog/osmose

```

Defining Osmose Filters
-----------------------

[](#defining-osmose-filters)

Osmose provides an artisan command `make-filter` that accepts the name of the filter to be generated, which quickly scaffolds a filter class

```
php artisan osmose:make-filter CharacterFilter

```

A `CharacterFilter.php` file will be created in the `App\Http\Filters` namespace.

***NB: The Filters folder will be automatically created if it does not exist.***

A filter class extends the `Agog\Osmose\Library\OsmoseFilter` template and implements the `Agog\Osmose\Library\Services\Contracts\OsmoseFilterInterface` interface.

It must define a `residue` method that returns an array defining the filtration rules

```
