Download the PHP package nahid-ferdous/laravel-searchable without Composer

On this page you can find all versions of the php package nahid-ferdous/laravel-searchable. 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-searchable

Laravel Searchable Documentation

Introduction

Overview

Laravel Searchable is a powerful and flexible package that simplifies database searching in Laravel applications. It provides an elegant, fluent interface for building complex search queries across model attributes, relationships, and date ranges without writing verbose query builder code.

The package extends Laravel's Eloquent models with a convenient search() method that handles common search patterns like partial matching, relationship searching, concatenated field searches, and date filtering.

Why Use Laravel Searchable?

Clean and Readable Code Transform complex search queries into simple, declarative syntax. Instead of writing multiple where and orWhere clauses, define your searchable fields in a straightforward array.

Relationship Search Support Seamlessly search across related models without manually writing whereHas queries. The package handles nested relationships automatically.

Flexible Search Patterns Support multiple search patterns out of the box:

Chainable and Composable Chain multiple search methods together to build complex queries progressively. Combine text searches, status filters, and date ranges in any order.

Zero Configuration Get started immediately with sensible defaults, or publish the configuration file for advanced customization.


Installation

Install the package via Composer:


Configuration

Publishing the Configuration File

To customize the package behavior, publish the configuration file:

This will create a config/searchable.php file where you can adjust package settings.


Setup

Adding the Trait to Your Model

To make a model searchable, import and use the Searchable trait:

That's it! Your model is now ready to use the searchable features.


Basic Usage

Simple Field Search

Search across one or more fields in your model:

What this does:

Generated SQL equivalent:

Understanding Search Operators

The package uses prefix operators to define search behavior:


Advanced Usage

Searching Across Relationships

Search through related models seamlessly:

Relationship syntax:

Generated SQL equivalent:

Concatenated Field Search

Search across multiple fields combined together (useful for full names, addresses, etc.):

Concatenation syntax:

Generated SQL equivalent:

Chaining Multiple Search Conditions

Combine multiple search criteria by chaining search() methods:

Generated SQL equivalent:


Date Searching

Single Date Search

Filter records by a specific date with comparison operators:

Supported operators:

Generated SQL equivalent:

Date Range Search

Filter records within a date range:

Date range format:

Operator for ranges:

Generated SQL equivalent:

Date Search with Relationships

Coming Soon

This feature will allow you to filter by dates in related models.

Date Range Search with Relationships

Coming Soon

This feature will allow you to filter by date ranges in related models.


Complete Example

Here's a real-world example combining multiple search features:

Example URL:


Tips and Best Practices

Performance Considerations

Handling Empty Search Values

The package automatically handles empty or null search values gracefully - they simply won't add any conditions to your query.

Combining with Other Query Methods

Since search() returns a query builder instance, you can chain any standard Eloquent methods:


API Reference

search($value, array $fields)

Adds search conditions to the query.

Parameters:

Returns: Query builder instance for method chaining

searchDate($value, array $fields, string $operator = '=')

Adds date-based search conditions to the query.

Parameters:

Returns: Query builder instance for method chaining


Troubleshooting

Common Issues

Search not working across relationships

Date search returning unexpected results

Performance issues with large datasets


Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


License

This package is open-sourced software licensed under the MIT license.


Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.


All versions of laravel-searchable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
laravel/framework Version >=6.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 nahid-ferdous/laravel-searchable contains the following files

Loading the files please wait ...