jord-jd/laravel-natural-where

Laravel Natural Where extends the Laravel query builder to allow expressing of where operators in natural language.

Fund package maintenance!
DivineOmega

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 0

Forks: 3

Open Issues: 1

pkg:composer/jord-jd/laravel-natural-where

v3.0.0 2026-02-14 23:30 UTC

This package is auto-updated.

Last update: 2026-02-14 23:35:21 UTC


README

Laravel Natural Where extends the Laravel query builder to allow expressing of where operators in natural language.

Installation

To install Laravel Natural Where, run the following command from the root of your project.

composer require jord-jd/laravel-natural-where

Usage

See the basic usage example below.

$query = \App\User::query()
    ->naturalWhere('created_at', 'is between the years', ['2018', '2020'])
    ->naturalWhere('email', 'contains the word', 'jordan')
    ->naturalWhere('name', 'is not', 'Jordan Smith')
    ->naturalWhere('id', 'is one of the following', [1, 2, 3])
    ->get();

This example will produce the following SQL query.

select * from `users` where (`created_at` >= '2018' and `created_at` <= '2020') 
and `email` LIKE '%jordan%' and `name` != 'Jordan Smith' and `id` in (1, 2, 3)