Looking to hire Laravel developers? Try LaraJobs

laravel-go-reports maintained by pingslayer

Description
High-performance Laravel reporting engine using an embedded Go sidecar for streaming millions of rows with zero memory bloat.
Author
Last update
2026/04/18 08:37 (dev-main)
License
Links
Downloads
1

Comments
comments powered by Disqus

📦 Laravel Go Reports (The Eloquent Tunnel)

Latest Version on Packagist Total Downloads License

A professional-grade reporting package for Laravel that "Tunnels" complex Eloquent queries to an embedded Go service for high-speed JSON streaming.


🚀 Installation

  1. Require the package:
composer require pingslayer/laravel-go-reports
  1. Publish the configuration:
php artisan vendor:publish --provider="LaravelGoReports\LaravelGoReportsServiceProvider" --tag="config"

🏗 Requirements

  • PHP: ^8.1
  • Laravel: ^10.0 | ^11.0 | ^12.0 | ^13.0
  • Database: MySQL ONLY (MariaDB supported)

  1. Auto-Start: When Laravel boots, it detects your OS and launches the bundled Go binary in the background.
  2. Auto-Init: It sends your database credentials to the Go engine once to establish a connection pool.
  3. Tunneling: When you call JSONReport::fromEloquent($query), the package extracts the raw SQL and Bindings and sends them to Go for execution and streaming.

📖 Usage

Using the Eloquent Tunnel (Recommended)

You can directly pipe any Laravel Query or Eloquent Builder into the engine. Go will handle the high-speed streaming without PHP memory issues.

use LaravelGoReports\JSONReport;

public function export() {
    $query = User::join('orders', 'users.id', '=', 'orders.user_id')
                 ->where('orders.total', '>', 500)
                 ->orderBy('orders.created_at', 'desc');

    // Returns a StreamedResponse directly to the browser
    return JSONReport::fromEloquent($query);
}

Advanced: Passing Raw SQL & Bindings

use LaravelGoReports\JSONReport;

return JSONReport::generate([
    'sql' => 'SELECT * FROM reports WHERE amount > ?',
    'bindings' => [500]
]);

🛠 Configuration (config/report.php)

return [
    'auto_start' => env('REPORT_ENGINE_AUTO_START', true),
    'port'       => env('REPORT_ENGINE_PORT', 8081),
    'secret_key' => env('REPORT_ENGINE_SECRET', 'laravel-go-sync'),
];

🛡 Security

  • The Go engine only permits SELECT statements.
  • Any destructive SQL (DELETE, DROP, UPDATE) is strictly blocked by a regex validator.
  • Database credentials are kept secure and shared with Go only during core initialization.

📄 License

MIT