PHPackages                             f-liva/eloquent-to-raw-sql - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. f-liva/eloquent-to-raw-sql

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

f-liva/eloquent-to-raw-sql
==========================

Exposes the eloquent toRawSql method to display the raw query in beautified form.

1.0.2(1y ago)0184MITPHP

Since Nov 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/f-liva/eloquent-to-raw-sql)[ Packagist](https://packagist.org/packages/f-liva/eloquent-to-raw-sql)[ Docs](https://github.com/f-liva/eloquent-to-raw-sql)[ RSS](/packages/f-liva-eloquent-to-raw-sql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Eloquent toRawSql
=================

[](#eloquent-torawsql)

Exposes the eloquent toRawSql method to display the raw query in beautified form.

Install
-------

[](#install)

`composer require f-liva/eloquent-to-raw-sql`

Use
---

[](#use)

```
$products = Product
    ::where('availability', 'available')
    ->where('type', 'goods')
    ->groupBy('category')
    ->orderByDesc('price')
    ->limit(10);

dump($products->toRawSql()); // Beautified SQL (as default)

//    SELECT
//        *
//    FROM
//        `products`
//    WHERE
//        `products`.`availability` = 'available'
//         AND `products`.`type` = 'goods'
//    GROUP BY
//        `products`.`category`
//    ORDER BY
//        `products`.`price` DESC
//    LIMIT 10;

dump($products->toRawSql(false)); // Unbeautified SQL

//  SELECT * FROM `products` WHERE `products`.`availability` ...
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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

3

Last Release

535d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/796e4d6545ebd619068a5905951de016ca61799e96c918f62a8659d1c04af1af?d=identicon)[f-liva](/maintainers/f-liva)

---

Tags

laravelto-raw-sqleloquent-to-raw-sql

### Embed Badge

![Health badge](/badges/f-liva-eloquent-to-raw-sql/health.svg)

```
[![Health](https://phpackages.com/badges/f-liva-eloquent-to-raw-sql/health.svg)](https://phpackages.com/packages/f-liva-eloquent-to-raw-sql)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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