lacasera / elastic-bridge
An eloquent way to search
Fund package maintenance!
Lacasera
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 5
pkg:composer/lacasera/elastic-bridge
Requires
- php: ^8.2|^8.3
- elasticsearch/elasticsearch: ^8.14
- illuminate/contracts: ^10.0|^11.0|^12.0
- laravel/prompts: ^0.1.9|^0.2|^0.3|^0.4|^0.5
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nesbot/carbon: ^2.63|^3.8.4
- nunomaduro/collision: ^8.1.1|^7.10.0
- nyholm/psr7: ^1.8
- orchestra/testbench: ^8.22.0|^9.0.0|^10.0.0
- php-http/mock-client: ^1.6
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.11
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^10.5
- rector/rector: ^1.2
This package is auto-updated.
Last update: 2025-10-25 23:48:44 UTC
README
ElasticBridge allows you to write Fluent, Eloquent like Elasticsearch queries in your laravel application.
With ElasticBridge, you can interact with Elasticsearch indexes as easily as you would with traditional Eloquent models, bringing the power of Elasticsearch into the Laravel ecosystem with no effort.
This package simplifies the complexity of Elasticsearch queries, allowing you to execute powerful search operations while maintaining the elegance and familiarity of Laravel's syntax.
Requirements
- PHP 8.2 or 8.3
- Laravel 10.x, 11.x, or 12.x
- Elasticsearch 8.x
Compatibility Matrix
| Laravel Version | PHP Version | Testbench Version | Carbon Version | PHPUnit Version |
|---|---|---|---|---|
| 10.x | 8.2, 8.3 | 8.* | ^2.63 | ^10.5 |
| 11.x | 8.2, 8.3 | 9.* | ^2.63 | ^10.5 |
| 12.x | 8.3 | 10.* | ^3.8.4 | ^11.5.3 |
Installation
Install the package via Composer:
composer require lacasera/elastic-bridge
Overview
php artisan make:bridge HotelRoom
<?php declare(strict_types=1); namespace App\Bridges; use Lacasera\ElasticBridge\ElasticBridge; class HotelRoom extends ElasticBridge { }
<?php declare(strict_types=1); namespace App\Http\Controllers; use App\Bridges\HotelRoom; use App\Requests\SearhRequest; class SearchController extends Controller { public function __invoke(SearhRequest $request) { $rooms = HotelRoom::asBoolean() ->matchAll() ->orderBy('price', 'DESC'), ->filterByTerm('code', 'usd') ->filterByRange('price', 20, 'gte') ->filterByRange('price', 500, 'lte') ->cursorPaginate(50) ->get(['price']); return response()->json([ 'data' => $rooms ]); } }
Documentation
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
TODO [] Add logging for queries and response...