Laravel PurityLaravel Purity
Introduction
  • Installation
  • Basic Usage
  • Additional Tutorials
  • Available Filters
  • Filtering
  • Sorting
  • Rename Fields
  • Relation Fields
  • Params Source
  • Allowed Fields
  • Livewire
  • Silent Exceptions
  • Filter

    • Restrict
    • Custom Filters
  • Sort

    • Null Sort
  • Upgrade Guide
Client Package
Ask a Question
GitHub
Introduction
  • Installation
  • Basic Usage
  • Additional Tutorials
  • Available Filters
  • Filtering
  • Sorting
  • Rename Fields
  • Relation Fields
  • Params Source
  • Allowed Fields
  • Livewire
  • Silent Exceptions
  • Filter

    • Restrict
    • Custom Filters
  • Sort

    • Null Sort
  • Upgrade Guide
Client Package
Ask a Question
GitHub
  • Introduction

    • How Does Purity Work?

Social Card of Laravel Purity

Elegant way to filter and sort queries in Laravel

TestsLicenseLatest Unstable VersionPHP Version RequireStyleCI

Laravel Purity is an elegant and efficient filtering and sorting package for Laravel, designed to simplify complex data filtering and sorting logic for eloquent queries. By simply adding filter() to your Eloquent query, you can add the ability for frontend users to apply filters based on URL query string parameters like a breeze.

Features :

  • Livewire support
  • Rename and restrict fields
  • Various filter methods
  • Simple installation and usage
  • Filter by relation columns
  • Custom filters
  • Multi-column sort

Laravel Purity is not only developer-friendly but also front-end developer-friendly. Frontend developers can effortlessly use filtering and sorting of the APIs by using the popular JavaScript qs package.

The way this package handles filters is inspired by strapi's filter and sort functionality.

How Does Purity Work?

Here is a basic usage example to clarify Purity's use case.

Add filter() to your query.

$posts = Post::filter()->get();

That's it! Now you can filter your posts by adding query string parameters to the URL.

GET /api/posts?filters[title][$contains]=Purity
Edit this page
Last Updated:
Contributors: Abbas mkhzomi
Next
Installation