PHPackages                             elfif/metasearch\_l5 - 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. elfif/metasearch\_l5

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

elfif/metasearch\_l5
====================

024.8k↓43.3%3PHPCI failing

Since Sep 27Pushed 5y ago2 watchersCompare

[ Source](https://github.com/elfif/metasearch_l5)[ Packagist](https://packagist.org/packages/elfif/metasearch_l5)[ RSS](/packages/elfif-metasearch-l5/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Metasearch\_l5
==============

[](#metasearch_l5)

Overview
--------

[](#overview)

Metasearch is a package for Laravel 5. It allows you to easily create an Eloquent query that match with a search form. By using a list of keywords on your search form input fields names, Metasearch\_l5 will automatically create the corresponding query . It's more or less a port of activerecord-hackery/meta\_search. Right n now i'm using it a lot in Rest web services, as it allows great flexibility when you need some search capabilities.

Here is a simple example :

first the search form :

```
{{ Form::open(['url' => URL::route('cars.search')]) }}
    {{ Form::label('year : ') }}
    {{ Form::text('year_equals') }}

	{{ Form::label('minumum horsepower : ') }}
    {{ Form::text('horsepower_greater_than') }}

	{{ Form::label('maximum horsepower : ') }}
    {{ Form::text('horsepower_less_than') }}

    {{ Form::submit('submit') }}
{{ Form::close() }}

```

Then in your CarsController :

```
	$input = Request::all();
    $query = Search::getQuery(Car::getQuery(), $input);
    $cars = $query->get();
	return view('cars.index', ['cars' => $cars]);

```

And that's it, the getQuery method will create the Query based on the Input content.

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

[](#installation)

first add the dependency to uyour composer.json file :

```
	"require": {
		"elfif/MetaSearch_L5" : "*"
	}

```

and do a composer install.

Then edit your app.php file. Add the service provider for this package :

```
	'Elfif\MetaSearch\MetaSearchServiceProvider'

```

and add the facade :

```
	'Search' => 'Elfif\MetaSearch\Facades\Search'

```

Now you are good to go !!

Syntax
------

[](#syntax)

Here is a list of all the keywords you can use with LaraSearch, based on their datatypes

### All data types

[](#all-data-types)

- *equals* (alias: *eq*) - Just as it sounds.
- *does\_not\_equal* (alias : \_noteq) - The opposite of equals, oddly enough.
- *is\_in* - Takes an array, matches on equality with any of the items in the array.
- *is\_not\_in* - Like above, but negated.
- *is\_null* - The column has an SQL NULL value.
- *is\_not\_null* - The column contains anything but NULL.

### Strings

[](#strings)

- \_contains - Substring match.
- \_does\_not\_contain - Negative substring match.
- \_starts\_with (alias: \_sw) - Match strings beginning with the entered term.
- \_does\_not\_start\_with (alias: \_dnsw) - The opposite of above.
- \_ends\_with (alias: \_ew) - Match strings ending with the entered term.
- \_does\_not\_end\_with (alias: \_dnew) - Negative of above.

### Numbers, dates, and times

[](#numbers-dates-and-times)

- \_greater\_than (alias: \_gt) - Greater than.
- \_greater\_than\_or\_equal (alias: \_gteq) - Greater than or equal to.
- \_less\_than (alias: \_lt) - Less than.
- \_less\_than\_or\_equal (alias: \_lteq) - Less than or equal to.

### Booleans

[](#booleans)

- \_is\_true - Is true. Useful for a checkbox like "only show admin users".
- \_is\_false - The complement of \_is\_true.

### Non-boolean data types

[](#non-boolean-data-types)

- \_is\_present - As with \_is\_true, useful with a checkbox. Not NULL or the empty string.
- \_is\_blank - Returns records with a value of NULL or the empty string in the column.

### ORed conditions

[](#ored-conditions)

If you'd like to match on one of several possible columns, you can do this:

```
	{{ Form::label('name : ') }}
    {{ Form::text('name_or_brand_equals') }}

```

Just keep in mind the condition will be the same for all columns.

### Querying relation existence

[](#querying-relation-existence)

##### Simple case

[](#simple-case)

You can also check for a relation existence using the keyword "exist" like that. Let's say we have a relation called accessories in our car model :

```
	public function accessories(){
		return $this->hasMany('App\Accessory');
	}

```

We can request that relation's existence using the keyword "\_exists" (or \_ex in short) this way :

```
	{{ Form::label('has accessories : ') }}
	{{ Form::checkbox('accessories_exists') }}

```

If the checkbox is checked it will add that condition to the query builder

```
	->has('accessories');

```

##### With a count

[](#with-a-count)

You may also specify an operator and count to further customize the query using the keyword "\_count" (or *co* in short) plus a keyword to define the condition

```
	{{ Form::label('has accessories : ') }}
	{{ Form::text('accessories_count_greater_than') }}

```

Will translate into :

```
	->has('accessories', '>=', $value);

```

##### Full condition

[](#full-condition)

If you need even more control over your conditions regarding a relation you can use that notation, with a dot between the relation and the field's name, followed by a condition

```
	{{ Form::label('accessories : ') }}
	{{ Form::text('accessories.type_contains') }}

```

It will translate into :

```
	->whereHas('accessories', function($query){
		return $query->where('type', 'like', '%'.$value.'%');
	});

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a116f4a80e3086ff3c757a67b4bea849981548bdd70e65a555548aac56128816?d=identicon)[elfif](/maintainers/elfif)

---

Top Contributors

[![elfif](https://avatars.githubusercontent.com/u/1546817?v=4)](https://github.com/elfif "elfif (28 commits)")[![accexs](https://avatars.githubusercontent.com/u/6426734?v=4)](https://github.com/accexs "accexs (1 commits)")[![Kryptonien](https://avatars.githubusercontent.com/u/9591373?v=4)](https://github.com/Kryptonien "Kryptonien (1 commits)")[![mcalvo-engeni](https://avatars.githubusercontent.com/u/40371224?v=4)](https://github.com/mcalvo-engeni "mcalvo-engeni (1 commits)")

### Embed Badge

![Health badge](/badges/elfif-metasearch-l5/health.svg)

```
[![Health](https://phpackages.com/badges/elfif-metasearch-l5/health.svg)](https://phpackages.com/packages/elfif-metasearch-l5)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

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

PHP Client for OpenSearch

15224.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)
