Download the PHP package liveintent/laravel-resource-search without Composer

On this page you can find all versions of the php package liveintent/laravel-resource-search. 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 laravel-resource-search

🔍 Laravel Resource Search

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status

This package allows you to easily and safely provide comprehensive filtering and sorting capabilities to your Laravel endpoints by simply defining which fields should be exposed in the corresponding Eloquent API Resource object.

The package is heavily inspired by the Spatie Query Builder and Laravel Orion.

Basic usage

Basic functionality is availble via query parameters in GET requests

Read more about basic search capabilities like: filters, pagination, search, sort...

Extended functionality is availble via body payload in POST requests

Read more about advanced search capabilities like: scopes, filters, pagination, search, sort...

Installation

You can install the package via composer:

The package will automatically register its service provider.

You can optionally publish the config file with:

Adding searchable resources to your API

Laravel's Eloquent API Resources serve as a transformation layer that sits betweeen your Eloquent models and the JSON responses that are actually returned to your application's usesr. For this reason, we think this is a great place to also define the capabilities your users should have when listing and searching those resources.

To transform any existing Eloquent resource into a Searchable Eloquent resource, you should have your resource use the Searchable trait provided by this package and instruct the resource that it implements the SearchableResource interface. Finally, you'll need to define a $model property on the resource which indicates which underlying Eloquent model should be used for the base query.

Adding search endpoints to your API

There are two methods users may use when searching your API. For simple, basic queries they may prefer to use a GET request with minimal query parameters to construct the query. Other times, users may want to construct more complex queries that require passing a larger request payload containing things like nested logical groups.

Adding a basic search endpoint

You can turn any new or existing endpoint into one that allows basic search by calling the basicSearch method on a SearchableResource and returning the result.

If you require additional control over the query, such as applying a query scope for example, create your query and pass the Builder into the basicSearch method to allow it to further filter results based on the user's input.

Adding an advanced search endpoint

You can turn any new or existing endpoint into one that allows advanced search by calling the search method on a SearchableResource and returning the result.

Just like with basic seearh, if you require additional control over the query you may pass an existing Builder into the search method and it will further filter results based on the user's input.

Documentation

You can find the documentation here.

Changelog

Please see CHANGELOG for information about what was changed recently.

Contributing

Please see CONTRIBUTING for details.

Why not...?

Before you use this package, there are several other options you should consider.


All versions of laravel-resource-search with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
laravel/framework Version ^9.24
spatie/laravel-package-tools Version ^1.12
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 liveintent/laravel-resource-search contains the following files

Loading the files please wait ....