PHPackages                             sulimanbenhalim/laravel-prose - 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. sulimanbenhalim/laravel-prose

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

sulimanbenhalim/laravel-prose
=============================

Transform Laravel Eloquent queries into natural language prose

1.0.0(8mo ago)110MITPHPPHP ^8.2CI failing

Since Aug 23Pushed 5mo agoCompare

[ Source](https://github.com/sulimanbenhalim/laravel-prose)[ Packagist](https://packagist.org/packages/sulimanbenhalim/laravel-prose)[ RSS](/packages/sulimanbenhalim-laravel-prose/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (3)Used By (0)

Laravel Prose
=============

[](#laravel-prose)

[![GitHub License](https://camo.githubusercontent.com/55fabcfe9f06d3878b76324669b2b95308d6409f229c9361a0edac523d38e879/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73756c696d616e62656e68616c696d2f6c61726176656c2d70726f7365)](https://github.com/sulimanbenhalim/laravel-prose/blob/main/LICENSE.md)[![PHP Version Support](https://camo.githubusercontent.com/2a38189ebddcd255237b8da46df2e1435923035f259b9e4b261fd98ad4e9cea2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d626c7565)](https://www.php.net/supported-versions.php)[![Laravel Version Support](https://camo.githubusercontent.com/7d9dee39eea8041406d20ac6913cea8fc4f696bf35e58f2dbccbb7fbbfed66d9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25334525334425323031322e302d726564)](https://laravel.com/docs/12.x/releases)

> Laravel Eloquent queries → natural language descriptions

[![Laravel Prose Demo](assets/demo.gif)](assets/demo.gif)

Install
-------

[](#install)

```
composer require sulimanbenhalim/laravel-prose
```

Usage
-----

[](#usage)

### Basic Query Translation

[](#basic-query-translation)

```
User::where('created_at', '>', '2024-01-01')->describe();
// → "Find users created after January 1, 2024"

Product::where('is_featured', true)
    ->orderBy('price_usd', 'desc')
    ->limit(10)
    ->describe();
// → "Find first 10 products that are featured sorted by price in USD (highest to lowest)"
```

### Advanced Operations

[](#advanced-operations)

```
// Carbon operations with natural language
Order::where('created_at', '>', now()->subWeeks(2))->describeCount();
// → "Count orders created within the last 14 days"

Customer::whereHas('orders', function($q) {
    $q->where('total_amount_usd', '>', 1000);
})->describe();
// → "Find customers who have orders with total amount in USD greater than 1000"

// Multi-column searches
Product::whereAny(['name', 'description'], 'like', '%laptop%')->describe();
// → "Find products whose either name or description contain 'laptop'"
```

### Action Descriptions

[](#action-descriptions)

All query operations get natural descriptions:

[![Update Demo](assets/demo-update.gif)](assets/demo-update.gif)

```
Customer::where('status', 'banned')->describeDelete();
// → "Delete customers with status is 'banned'"

User::where('last_login_at', '', now()->subDays(30))->describe();
// → "Find customers who verified their email within the last 30 days"

Customer::whereNull('email_verified_at')->describe();
// → "Find customers with unverified email"
```

### Currency &amp; Units

[](#currency--units)

```
Product::where('price_usd', '>', 100)->describe();
// → "Find products with price in USD greater than 100"

Customer::whereBetween('total_lifetime_spending_usd', [500, 5000])->describe();
// → "Find customers with total lifetime spending in USD ranging from 500 to 5000"
```

Configuration
-------------

[](#configuration)

```
php artisan vendor:publish --tag=prose-config
```

**All Settings**SettingDefaultDescription`enabled``true`Enable/disable prose generation`humanize_dates``true`Convert dates to natural language`max_conditions``12`Limit conditions to prevent overflow`include_raw_fallback``true`Show fallback for complex queries`raw_fallback_text``"with custom database operations"`Text for unsupported operations`sentence_template``"{action} {model} {conditions}..."`Output structure`actions.select``"Find"`Action word for select queries`actions.count``"Count"`Action word for count queries`connectors.and``"and"`Connector for AND conditions`connectors.relationships``"including their"`Relationship connectorMethods
-------

[](#methods)

### Query Description

[](#query-description)

```
$builder->describe();                    // Basic description
$builder->describeCount();               // Count operation
$builder->describeSum($column);          // Sum operation
$builder->describeAvg($column);          // Average operation
$builder->describeMax($column);          // Maximum operation
$builder->describeMin($column);          // Minimum operation
$builder->describeUpdate($values);       // Update operation
$builder->describeDelete();              // Delete operation
```

### Facade Access

[](#facade-access)

```
use SulimanBenhalim\Prose\Facades\Prose;

Prose::describe($builder);              // Direct access
```

Real-World Scenarios
--------------------

[](#real-world-scenarios)

### E-commerce Analytics

[](#e-commerce-analytics)

```
// Complex product analysis
Product::where('is_featured', true)
    ->where('stock_quantity_available', '>', 0)
    ->whereHas('reviews', function($q) {
        $q->where('rating', '>=', 4);
    })
    ->with('category', 'reviews')
    ->orderBy('sales_count', 'desc')
    ->limit(20)
    ->describe();

// → "Find first 20 products that are featured, with stock quantity available
//    greater than 0 and who have product reviews with rating greater than or equal to 4
//    including their category and reviews sorted by sales count (highest to lowest)"
```

### User Behavior Analysis

[](#user-behavior-analysis)

```
// Recently active premium users
Customer::where('is_premium_member', true)
    ->where('last_login_at', '>', now()->subDays(7))
    ->whereNotNull('email_verified_at')
    ->with('subscriptions')
    ->orderBy('total_lifetime_spending_usd', 'desc')
    ->describe();

// → "Find customers that are premium member, with last login within the last 7 days
//    and with verified email including their subscriptions sorted by total lifetime
//    spending in USD (highest to lowest)"
```

Laravel Integration
-------------------

[](#laravel-integration)

The package seamlessly integrates with Laravel's query builder through macros, automatically detecting:

- **Model casts** for boolean/date field detection
- **Database schema** via Doctrine DBAL for precise field types
- **Laravel conventions** for timestamp and relationship naming
- **Carbon operations** for intelligent time phrase generation
- **Doctrine Inflector** for proper pluralization and word transformations

Performance
-----------

[](#performance)

- **Zero query execution** - descriptions are generated from builder state
- **Configurable limits** prevent description overflow
- **Lazy evaluation** - only processes when `describe()` is called

Laravel Version Compatibility
-----------------------------

[](#laravel-version-compatibility)

Laravel VersionPackage Version12.x1.xSecurity
--------

[](#security)

If you discover any security issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Every ~0 days

Total

2

Last Release

262d ago

Major Versions

0.10.0 → 1.0.02025-08-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7720f88731294f320b81cfdab22d8a12ed4f49cc2502f0f54fc989f3c6ef6f?d=identicon)[sulimanbenhalim](/maintainers/sulimanbenhalim)

---

Top Contributors

[![sulimanbenhalim](https://avatars.githubusercontent.com/u/44615499?v=4)](https://github.com/sulimanbenhalim "sulimanbenhalim (6 commits)")

---

Tags

laravelormeloquentqueryreadabledescriptionnatural-languageprose

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sulimanbenhalim-laravel-prose/health.svg)

```
[![Health](https://phpackages.com/badges/sulimanbenhalim-laravel-prose/health.svg)](https://phpackages.com/packages/sulimanbenhalim-laravel-prose)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[jerome/filterable

Streamline dynamic Eloquent query filtering with seamless API request integration and advanced caching strategies.

19226.1k](/packages/jerome-filterable)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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