Download the PHP package andydefer/php-search without Composer
On this page you can find all versions of the php package andydefer/php-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package php-search
PHP Search - Documentation
📦 Présentation
PHP Search est une bibliothèque PHP moderne pour la recherche floue dans des fichiers JSONL. Elle offre une solution complète avec indexation persistante, cache des résultats et support multi-index.
Caractéristiques principales
- ✅ Recherche floue basée sur l'analyse de n-grams (2, 3 et 4)
- ✅ Indexation persistante pour des recherches ultra-rapides
- ✅ Cache automatique des résultats (TTL 24h)
- ✅ Multi-index : gérez plusieurs sources indépendantes
- ✅ Streaming : lisez ligne par ligne sans surcharge mémoire
- ✅ Support multi-format : fichiers, dossiers, streams, itérables
- ✅ CLI complet pour l'indexation et la recherche
- ✅ Architecture modulaire avec injection de dépendances
- ✅ Support PHP 8.2+ avec types stricts
🚀 Installation
🎯 Utilisation rapide
En ligne de commande
En PHP
📚 Architecture
Moteurs de recherche
| Moteur | Description | Usage |
|---|---|---|
SearchEngine |
Moteur principal avec indexation persistante | Production, gros volumes |
JsonlSearchEngine |
Recherche directe sans index | Petits volumes, tests |
Composants principaux
📝 API principale
SearchEngine
| Méthode | Description |
|---|---|
index(string $source): int |
Indexe une source (dossier/fichier) |
search(string $query, int $limit = 5, ?string $source = null): array |
Recherche dans l'index |
hasIndex(?string $source = null): bool |
Vérifie l'existence d'un index |
getIndexStats(?string $source = null): array |
Statistiques de l'index |
deleteIndex(?string $source = null): void |
Supprime un index |
clearCache(?string $source = null, ?string $query = null): void |
Vide le cache |
listIndexes(): array |
Liste tous les index |
JsonlSearchEngine
| Méthode | Description |
|---|---|
searchInDirectory(string $directory, array $fields, string $query, int $limit = 5): array |
Recherche dans un dossier |
searchInFile(string $filePath, array $fields, string $query, int $limit = 5): array |
Recherche dans un fichier |
searchInStream($stream, array $fields, string $query, int $limit = 5): array |
Recherche dans un stream |
searchInIterable(iterable $iterable, array $fields, string $query, int $limit = 5): array |
Recherche dans un itérable |
searchInIndex(string $indexPath, string $query, int $limit = 5): array |
Recherche dans un index |
💡 Cas d'utilisation
1. Indexation de logs JSONL
2. Cache de résultats de recherche
3. Multi-index pour différents domaines
4. Recherche directe sans index
🔧 CLI - Commandes complètes
📊 Performance
| Opération | Complexité | Notes |
|---|---|---|
| Indexation | O(n × m) | n = lignes, m = champs |
| Recherche (cache hit) | O(1) | Lecture fichier cache |
| Recherche (cache miss) | O(i) | i = items dans l'index |
| Recherche directe | O(f × l) | f = fichiers, l = lignes |
🔗 Dépendances
PHP ^8.2- Langage requisandydefer/php-jsonl- Gestion des fichiers JSONLandydefer/php-services- Services de baseandydefer/php-vo- Value objectsandydefer/domain-structures- Structures de domaine
📜 License
MIT License
👨💻 Auteur
Andy Kani - [email protected]
🙏 Contributions
Les contributions sont les bienvenues !
📖 Résumé rapide
All versions of php-search with dependencies
PHP Build Version
Package Version
The package andydefer/php-search contains the following files
Loading the files please wait ...