🛠Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
1.98k
stars
147
forks
source link
How can I customize response messages for the user #312
Open
txandre opened 4 months ago
how can I customize response messages for the user
try { $arr = ['title' => 'aa', 'bar' => 'a', 'foo' => 'a']; v::assert($arr['title'], 'string:5', 'example message 1'); v::assert($arr['bar'], 'string:15', 'example message 2'); v::assert($arr['foo'], 'int', 'example message 3'); } catch (AssertionException $e) { echo '<pre>'; print_r($e->getMessage()); }
current answer
The **example message 1** expects to be string in range 5, string 'aa' given.
the current message appears between the default message.
thanks