Laravel Query Builder

screenshot of Laravel Query Builder
laravel

Easily build Eloquent queries from API requests

Overview

The Laravel Query Builder package by Spatie allows users to build eloquent queries based on API requests. Users can filter, include relations, and sort queries using request parameters that follow the JSON API specification. The package extends Laravel's default Eloquent builder, maintaining compatibility with existing methods and macros.

Features

  • Filtering: Filter queries based on specific criteria such as name, with options for partial filters, exact filters, scope filters, and custom filters.
  • Including Relations: Include related models in the query results, with support for including nested relationships, relationship counts, and custom includes.
  • Sorting: Sort query results based on specified fields, with options for custom sorts and sort directions.
  • Field Selection: Select specific fields to be included in the query results by specifying the fields parameter.

Summary

The Laravel Query Builder package by Spatie provides a convenient way to interact with Eloquent models by allowing users to easily filter, include relations, and sort query results based on API requests. With compatibility with Laravel's default Eloquent builder and adherence to JSON API specifications, this package offers a powerful tool for building eloquent queries. Users can also support the developers by purchasing paid products or sending postcards, with detailed documentation and support resources available for further assistance.

laravel
Laravel

Laravel is a powerful and elegant PHP framework that provides developers with a comprehensive set of tools and features to build robust web applications. It follows the Model-View-Controller (MVC) architectural pattern, offering a clean and organized structure for writing efficient and maintainable code.