Skip to content

Commit db9f52e

Browse files
config documentation
1 parent bf64740 commit db9f52e

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

config/encrypted-search.php

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,82 @@
11
<?php
22

3+
/**
4+
* -----------------------------------------------------------------------------
5+
* Ginkelsoft Laravel Encrypted Search Index - Configuration
6+
* -----------------------------------------------------------------------------
7+
*
8+
* This configuration file defines how the encrypted search indexing system
9+
* behaves. It supports both local database indexing and Elasticsearch as
10+
* a backend. It also provides automatic detection of encrypted model casts,
11+
* customizable prefix depth, and peppering for secure token hashing.
12+
*
13+
* @package Ginkelsoft\EncryptedSearch
14+
*/
15+
316
return [
17+
418
/*
519
|--------------------------------------------------------------------------
620
| Search Pepper
721
|--------------------------------------------------------------------------
8-
| Een geheime “pepper” die wordt mee-gehasht met genormaliseerde tokens.
9-
| Dit voorkomt dat een gelekte index triviaal terug te rekenen is.
10-
| Zet dit in .env als SEARCH_PEPPER="random-string".
22+
|
23+
| A secret “pepper” value that is concatenated with the normalized text
24+
| before hashing. This ensures that even if the token index is leaked,
25+
| it cannot be reversed or correlated with plaintext values.
26+
|
27+
| Define this in your `.env` file, for example:
28+
| SEARCH_PEPPER="random-secret-string"
29+
|
1130
*/
1231
'search_pepper' => env('SEARCH_PEPPER', ''),
1332

1433
/*
1534
|--------------------------------------------------------------------------
16-
| Prefix token lengte
35+
| Maximum Prefix Depth
1736
|--------------------------------------------------------------------------
18-
| Maximaal aantal prefix-niveaus voor prefix-zoekopdrachten.
19-
| Bijv. "wietse" -> ["w","wi","wie"]
37+
|
38+
| The maximum number of prefix levels to generate for prefix-based search.
39+
| For example, the term “wietse” would generate:
40+
| ["w", "wi", "wie", "wiet", "wiets", "wietse"]
41+
|
42+
| Increasing this value improves search precision for short terms, but
43+
| slightly increases the number of stored tokens per record.
44+
|
2045
*/
2146
'max_prefix_depth' => 6,
2247

2348
/*
2449
|--------------------------------------------------------------------------
25-
| Auto-index encrypted casts
50+
| Automatic Indexing of Encrypted Casts
2651
|--------------------------------------------------------------------------
2752
|
28-
| When enabled, the package will automatically include any model attributes
29-
| that use Laravel's "encrypted" casts (e.g. AsEncryptedString, AsEncryptedArray)
30-
| in the encrypted search index.
53+
| When enabled, the package automatically includes any model attributes
54+
| that use Laravel’s encrypted cast types (e.g. AsEncryptedString,
55+
| AsEncryptedArrayObject, etc.) in the search index.
3156
|
32-
| You can still override or fine-tune behavior via:
57+
| You can still override or refine behavior per field via:
3358
| - Attributes: #[EncryptedSearch(exact: true, prefix: false)]
34-
| - The $encryptedSearch property on your model
59+
| - Model property: protected array $encryptedSearch
3560
|
3661
*/
3762
'auto_index_encrypted_casts' => true,
3863

64+
/*
65+
|--------------------------------------------------------------------------
66+
| Elasticsearch Integration
67+
|--------------------------------------------------------------------------
68+
|
69+
| Configure Elasticsearch as the backend for storing and querying
70+
| encrypted search tokens. When enabled, the package will skip all
71+
| database writes to `encrypted_search_index` and instead sync tokens
72+
| directly to Elasticsearch using the internal ElasticsearchService.
73+
|
74+
| Example environment configuration:
75+
| ENCRYPTED_SEARCH_ELASTIC_ENABLED=true
76+
| ELASTICSEARCH_HOST=http://localhost:9200
77+
| ELASTICSEARCH_INDEX=encrypted_search
78+
|
79+
*/
3980
'elasticsearch' => [
4081
'enabled' => env('ENCRYPTED_SEARCH_ELASTIC_ENABLED', false),
4182
'host' => env('ELASTICSEARCH_HOST', 'http://elasticsearch:9200'),

0 commit comments

Comments
 (0)