jesseobrien / reach
PHP Redis search library.
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/jesseobrien/reach
Requires
- illuminate/redis: 4.1.*@dev
- illuminate/support: 4.1.*@dev
Requires (Dev)
- mockery/mockery: 0.9.*@dev
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2025-12-16 12:53:03 UTC
README
Redis search layer in PHP.
Install
Add "jesseobrien/reach": "dev-master" to the require section of your composer.json.
Usage
Insert A Book
# Ensure your object has the searchable variables set. class Book { protected $searchableAttributes = ['name', 'author']; protected $searchableNamespace = 'books'; } // Create a new book and save it to the database. $b = new Book(); $b->name = 'The Adventures of Sherlock Holmes'; $b->author = 'Arthur Conan Doyle'; $b->save(); // Now that our object has an id from save(), insert it into Reach $searchIndex = new Reach(); $searchIndex->add($b);
Find Books
// Search in books for 'sherlock holmes' // Reach will return the ids of books it finds matching 'sherlock' and 'holmes' $ids = $searchIndex->find('books', 'sherlock holmes'); $results = []; foreach ($ids as $id) { $result[] = Book::find($id); }