Download the PHP package laravelwakeup/filter-sort without Composer

On this page you can find all versions of the php package laravelwakeup/filter-sort. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filter-sort

Filter Sort Scope for Laravel

Release Downloads License

Table of Contents

Introduction

This package provides FilterTrait and SortTrait to help you filter and sort data dynamically with various operators in Laravel Eloquent.

Requirements

I. Installation & Configuration

1. Install

2. Publish Configuration

After running the command above, the laravel-filter-sort.php config file will be created in your config/ directory. You can adjust the following settings:

II. Basic Usage

1. Add Traits to Your Model

Note: By default, if you don't define or set empty arrays for $allowedFilters and $allowedSorts, the package will allow filtering and sorting on all table fields.

2. Use in Controller

III. Available Operators

Operator Query String Description
like (default) title=Laravel Filter data with LIKE "%Laravel%"
eq status=published&status_op=eq Filter where status = 'published'
gt created_at=2023-01-01&created_at_op=gt Filter where created_at > '2023-01-01'
gte created_at=2023-01-01&created_at_op=gte Filter where created_at >= '2023-01-01'
lt created_at=2023-01-01&created_at_op=lt Filter where created_at < '2023-01-01'
lte created_at=2023-01-01&created_at_op=lte Filter where created_at <= '2023-01-01'
between created_at=2023-01-01,2023-12-31&created_at_op=between Filter data within range
notIn status=draft,pending&status_op=notIn Exclude values in the list
in status=draft,pending&status_op=in Filter values in the list
null deleted_at=1&deleted_at_op=null Filter where field is NULL
notNull deleted_at=1&deleted_at_op=notNull Filter where field is NOT NULL

IV. Examples

1. Sorting

The package provides a simple and flexible way to sort your data. Sorting is applied only when sort parameters are present in the request.

1.1 Sorting Parameters

For any field you want to sort by (e.g., id, created_at, title), append _sort to the field name:

1.2 Multiple Sort Example

1.3 Restrict Sortable Fields

You can customize sorting behavior in your model:

1.4 Customize Sort Field Suffix

You can change the default _sort suffix by publishing the config file and modifying the sort_field_suffix value:

Note: Sorting is only applied when sort parameters are provided in the request. The order of sorting follows the order of parameters in the URL.

2. Search

2.1 Basic search

2.2 Range Search

Use two separate inputs for the start and end of the range. These inputs must have the suffix _start_range and _end_range, which are fixed and required for the range query to work correctly.

Note: The suffixes _start_range and _end_range are fixed and must be used exactly as shown to ensure the range queries are processed correctly.

2.3 List Search

2.4 Multi-Column Search

The multi-column search feature allows you to search across multiple columns using a single search term. This is useful for implementing a search bar that can search across different fields in your database.

Define Multi-Column Search Configuration in Your Model

In your Eloquent model, define a multiColumnSearch property to specify which fields should be included in the search and the operators to use.

Suppose you have a search input in your form with the name search_txt. When the form is submitted, the filter scope will automatically apply the search term to the specified fields using the defined operators.

This will search the username and server fields in the accounts table using the specified operators.

V. JavaScript Usage

1. Using with qs library

2. Using URLSearchParams (Browser built-in)

VI. License

The MIT License (MIT). Please see License File for more information.


All versions of filter-sort with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^11.0|^10.0|^9.0|^8.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laravelwakeup/filter-sort contains the following files

Loading the files please wait ...