PHPackages                             eslam-abass/model-search - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. eslam-abass/model-search

ActiveLibrary[Search &amp; Filtering](/categories/search)

eslam-abass/model-search
========================

A dynamic model search system for Laravel

02PHPCI passing

Since Apr 19Pushed 1mo agoCompare

[ Source](https://github.com/eslamabdallah74/model-search)[ Packagist](https://packagist.org/packages/eslam-abass/model-search)[ RSS](/packages/eslam-abass-model-search/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

eslam/model-search
==================

[](#eslammodel-search)

[![Packagist](https://camo.githubusercontent.com/91101152cd4c1390f812d2ed74dc0a2890cc343f1acd8e6331a6236dcea4a26c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65736c616d2f6d6f64656c2d7365617263682e737667)](https://packagist.org/packages/eslam/model-search)[![Packagist Downloads](https://camo.githubusercontent.com/7f9dc6de98607d6f90e93996b30ca3c6b4ee7cbb70bf0469d8c4c2943670dec0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65736c616d2f6d6f64656c2d7365617263682e737667)](https://packagist.org/packages/eslam/model-search)[![License](https://camo.githubusercontent.com/a30a5774b77d43aa83b29d386636328dccf8066881bb889662829cb4c03fe708/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f65736c616d2f6d6f64656c2d7365617263682e737667)](https://packagist.org/packages/eslam/model-search)[![PHP](https://camo.githubusercontent.com/9975bed8cd511c6cdd02199c182e451f259380a97ec444dc184894161b71df5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f65736c616d2f6d6f64656c2d7365617263682e737667)](https://packagist.org/packages/eslam/model-search)

A production-ready Laravel package that provides a dynamic model search system with auto-discovery, security, and high performance. Designed for Laravel 9-11.

Features
--------

[](#features)

- **Model Auto-Discovery**: Automatically scans and detects all Eloquent models in `app/Models`
- **Secure Model Access**: Config-based whitelist for allowed models
- **Dynamic Field Discovery**: Extracts database columns using Schema with field whitelisting
- **Relationship Support**: Search related fields using dot notation (e.g., `user.email`)
- **REST API Endpoints**: Built-in API routes for searching
- **Pagination**: Laravel pagination with meta data
- **Sorting**: Sort by any allowed field
- **Performance Optimization**: Caching, eager loading, optimized queries

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 9.0+ / 10.0+ / 11.0+

Installation
------------

[](#installation)

### 1. Install the package

[](#1-install-the-package)

```
composer require eslam/model-search
```

### 2. Publish the configuration

[](#2-publish-the-configuration)

```
php artisan vendor:publish --provider="Eslam\ModelSearch\Providers\ModelSearchServiceProvider" --tag="model-search-config"
```

This will create `config/model-search.php` in your Laravel application.

### 3. Configure the package

[](#3-configure-the-package)

Edit `config/model-search.php`:

```
