netgen/query-translator
Laravel package that translates request input into structured query criteria for filtering, sorting, pagination, and includes. Build safe, reusable query pipelines for Eloquent with configurable mappings and operators, keeping controllers thin and consistent across endpoints.
bind()) and can integrate with Scout (Laravel’s search abstraction) or custom repositories.ServiceProvider stubs). May require wrapping in a Laravel package for seamless adoption.DB::query() builders). Limited out-of-the-box support for full-text search in MySQL/PostgreSQL without extensions.Illuminate\Database\QueryException). Custom middleware may be needed.Criteria patterns) that could conflict or complement this?where() clauses (overkill).ExpressionLanguage for existing AST evaluation.composer require netgen/query-translator).laravel-query-translator) to:
try-catch or feature flags).QueryTranslator as a singleton or context-bound instance.// Example: Custom Scout Driver
public function scope($query, $scope)
{
$ast = QueryTranslator::translate($scope['query']);
return $this->elasticsearch->search($ast->toElasticsearch());
}
$ast = QueryTranslator::translate('title:laravel AND price > 100');
$sql = $ast->toSql(); // Hypothetical method
QueryTranslator::translateForScout()).app['log']->error).dd($ast->toArray()) to inspect translated queries.QueryTranslationException types.How can I help you explore Laravel packages today?