Download the PHP package shammaa/laravel-search without Composer
On this page you can find all versions of the php package shammaa/laravel-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shammaa/laravel-search
More information about shammaa/laravel-search
Files in shammaa/laravel-search
Package laravel-search
Short Description Professional, high-performance search library for Laravel with MySQL Full-Text Search, advanced query builder, Arabic support, and search analytics
License MIT
Homepage https://github.com/shammaa/laravel-search
Informations about the package laravel-search
Laravel Search
A professional, high-performance search library for Laravel with MySQL Full-Text Search, advanced query builder, Arabic support, and search analytics.
β¨ Features
Core Features
- π MySQL Full-Text Search - Fast search using native FULLTEXT indexes (no external dependencies)
- π Advanced Query Builder - Powerful, fluent query builder with filters, facets, and sorting
- π Arabic Language Support - Excellent Arabic search capabilities
- β‘ Auto-Indexing - Automatic FULLTEXT index creation and management
- π Search Analytics - Track searches, popular queries, and statistics
- π― Faceted Search - Advanced faceted search with multiple filters
- π‘ Auto-complete - Built-in autocomplete functionality
Performance & Scalability
- π Queue Support - Non-blocking index creation with queue jobs
- πΎ Smart Caching - Intelligent caching for search results and popular queries
- βοΈ Zero Configuration - Works out of the box with sensible defaults
- π Scalable - Handles millions of records efficiently
Developer Experience
- π¨ Type Safe - Full type hints and strict types (PHP 8.1+)
- π οΈ Artisan Commands - Comprehensive CLI tools for index management
- π¦ Laravel Integration - Seamless integration with Laravel ecosystem
- π Facade Support - Clean, expressive API
π Requirements
- PHP >= 8.1
- Laravel >= 9.0
- MySQL >= 5.6 (with FULLTEXT support) or MariaDB >= 10.0
π¦ Installation
1. Install via Composer
2. Publish Configuration (Optional)
This creates config/search.php with all available options.
3. Configure Environment (Optional)
Add these to your .env file if you want to customize defaults:
π Quick Start
Step 1: Add Searchable Trait to Your Model
Step 2: Create FULLTEXT Index
This creates a FULLTEXT index on your searchable fields. The index is created automatically when you first create a model, but you can also create it manually.
Step 3: Start Searching!
π Usage Guide
Basic Search
Advanced Filtering
WHERE Clauses
WHERE IN / NOT IN
NULL Checks
Range Queries
Faceted Search
Faceted search allows you to get aggregated counts for different field values:
Sorting
Autocomplete
Arabic Search
The package automatically supports Arabic text search:
Using the Facade
π― Artisan Commands
Index Management
Statistics & Monitoring
βοΈ Configuration
The config/search.php file contains all configuration options:
MySQL Configuration
Indexing Configuration
Cache Configuration
Analytics Configuration
Performance Configuration
π§ Advanced Usage
Custom Search Modes
MySQL supports two search modes:
Natural Language Mode (Default)
Best for: Natural language queries, relevance ranking
Boolean Mode
Allows operators like +, -, *, "phrase":
Queue Configuration
For large datasets, use queues for indexing:
Make sure your queue worker is running:
Manual Index Management
π Performance
Benchmarks
Based on testing with typical hardware:
| Records | Search Time | Memory Usage |
|---|---|---|
| 10K | 10-50ms | ~2MB |
| 100K | 50-150ms | ~5MB |
| 1M | 100-500ms | ~10MB |
| 10M | 500ms-2s | ~20MB |
Performance varies based on hardware, query complexity, and data characteristics.
Optimization Tips
- Use Caching: Enable caching for frequently searched queries
- Queue Indexing: Use queues for large datasets
- Limit Results: Use
limit()to reduce result set size - Select Fields: Only select needed fields with
select() - Index Optimization: Ensure your MySQL FULLTEXT indexes are optimized
- MySQL Configuration: Adjust
ft_min_word_lenfor shorter words
MySQL FULLTEXT Configuration
To search for words shorter than 4 characters, modify MySQL configuration:
Then rebuild your indexes:
π Troubleshooting
No Search Results
-
Check if index exists:
-
Verify minimum word length:
- MySQL default is 4 characters
- Words shorter than this won't be indexed
- Solution: Adjust
ft_min_word_lenin MySQL config
- Check searchable fields:
Slow Search Performance
-
Enable caching:
-
Use queue for indexing:
-
Limit results:
- Check MySQL FULLTEXT index:
Index Creation Fails
-
Check table engine:
- Must be InnoDB or MyISAM
- InnoDB recommended for MySQL 5.6+
-
Check column types:
- FULLTEXT only works with TEXT and VARCHAR columns
- Check MySQL version:
- MySQL 5.6+ required for InnoDB FULLTEXT
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
π License
This package is open-sourced software licensed under the MIT license.
π¨βπ» Author
Shadi Shammaa
- Email: [email protected]
- GitHub: @shammaa
π Credits
This package uses MySQL Full-Text Search instead of external search engines, making it:
- β Easy to install (no external dependencies)
- β Cost-effective (100% free)
- β Simple to maintain (uses your existing MySQL database)
- β Production-ready (battle-tested MySQL technology)
Perfect for applications that need powerful search without the complexity of managing external search servers like Elasticsearch or Meilisearch.
π Additional Resources
πΊοΈ Roadmap
- [ ] Add comprehensive test suite
- [ ] Add highlighting support
- [ ] Add search suggestions based on analytics
- [ ] Add multi-language stemming
- [ ] Add search result export
- [ ] Add search query builder UI component
- [ ] Add Livewire components for search UI
Made with β€οΈ for the Laravel community
All versions of laravel-search with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
illuminate/cache Version ^9.0|^10.0|^11.0|^12.0
illuminate/queue Version ^9.0|^10.0|^11.0|^12.0