The config/blasp.php file controls the behavior of the profanity filter. Key configuration sections include:
default: The driver to use ('regex', 'pattern', 'phonetic', or 'pipeline').language: The default language (e.g., 'english').mask: The default character used for masking (e.g., '*').severity: The minimum severity level to trigger detection ('mild', 'moderate', 'high', or 'extreme').events: Boolean to enable/disable global events.cache: Settings for result caching, including enabled, driver, ttl, and results (to cache check() results by content hash).middleware: Configuration for request-level filtering, including action ('reject' or 'sanitize'), fields to check, except to skip, and severity threshold.model: Configuration for the Blaspable trait, specifically the mode ('sanitize' or 'reject').drivers.phonetic: Settings for phonetic detection like phonemes (2-8), min_word_length, max_distance_ratio (0.3-0.8), and false_positives.allow / block: Global allow-lists and block-lists.separators / substitutions / false_positives: Custom character handling and word exclusions.
return [
'default' => env('BLASP_DRIVER', 'regex'), // 'regex' | 'pattern' | 'phonetic' | 'pipeline'
'language' => env('BLASP_LANGUAGE', 'english'), // Default language
'mask' => '*', // Default mask character
'severity' => 'mild',
'events' => false,
'cache' => [
'enabled' => true,
'driver' => env('BLASP_CACHE_DRIVER'),
'ttl' => 86400,
'results' => true,
],
'middleware' => [
'action' => 'reject',
'fields' => ['*'],
'except' => ['password', 'email', '_token'],
'severity' => 'mild',
],
'model' => [
'mode' => env('BLASP_MODEL_MODE', 'sanitize'), // 'sanitize' | 'reject'
],
'drivers' => [
'pipeline' => [
'drivers' => ['regex', 'phonetic'], // Sub-drivers to chain
],
'phonetic' => [
'phonemes' => 4,
'min_word_length' => 3,
'max_distance_ratio' => 0.6,
'supported_languages' => ['english'],
'false_positives' => ['fork', '...'],
],
],
'allow' => [],
'block' => [],
'separators' => [...],
'substitutions' => [...],
'false_positives' => [...],
];