Releases: leafsphp/form
π YΗnxΗ
v3.2 - 9 Nov 2024
Added
- Added
expanded
rule to switch to displaying an array of all failures
Changed
- Form will now show only one failure as a string by default
π permettre
v3.1 - 8 Nov 2024
Added
- Added
matchesvalueof
rule to check if one value matches another value in the request
Fixed
validate()
returns only the validated items- Fixed rule string-array relation on callable rules
π permitir
v3.0 - 7 Nov 2024
Added
- Added new validators like
truefalse
,numeric
,float
andhardfloat
Fixed
-
Fixed inconsistencies in validation. Internally, there were some issues that led to validators being inefficient and/or insecure (of course, other parts of Leaf covered up the vulnerabilities). This version removes all those weak links and makes validation more consistent between functions
-
Fixed breaks when chaining complex validators as strings. There was an issue where chaining complex validators like
min:x
andcontains:x
as strings could break the validation flow, this was also the case with array and |. Basically, all those issues have been fixed now. -
Additional petty fixes have been made to validators that did not work as expected
in
the previous version. An example is the in validator which just did not work right depending on the condition. This and other validators have been fixed in this version.
Changed
-
Every item that should be validated is required by default. v2.x had the opposite flow where every item was optional by default, so you needed to add
required
. This was quite clumsy because more often than not, people validate required fields. This update corrects that behaviour and offers anoptional
rule for fields that can be empty or nullable. -
The previous version had an
array()
rule which was considered a "special rule" different from the way all other rules were validated. This had some problems like performance issues and also errors when using complex validators like min:x together with array(). There were also issues when combining multiple validators together with array() eg:array(string|numeric)
which should accept['123']
but this failed. array() is replaced by the array rule in this version which is a real rule but can also be extended to validate items in an array likearray<numeric|string>
. Unlike the previous version, this also works with complex validators:array<string|min:3|between:[2,5]>
Removed
- As explained,
array()
has been replaced byarray<>
test()
has been replaced byvalidateRule()
πββοΈ Esqui
v2.2 - 24 August 2024
Changed
- Updated to Leaf's new config API
π KenshΕ
v2.1
Added
- Added optional param validation
- Added array validation with dot notation (#8)
Fixed
- Patched up
array()
failing on PHP 8.1
Thanks @Rasalas @mychidarko
π Envelope from Heaven
v2.0 - 1 Sep 2023
Added
- Added support for regex rules
- Add support for array validation using
array(...)
- Added a new set of rules for validation (view the docs)
- Added case support for
{field}
template - Added
{value}
template - Added
test()
method to check if data meets a condition - Added
rule()
method - added
message()
method
Changed
- Validation doesn't rely on Leaf Request
- You are now required to pass in data you want to validate
- Successful validation returns the validated data
Removed
- Removed
sanitizeInput()
method - Removed
validateField()
method - Removed
body()
method - Removed
get()
method
π Envelope from Heaven [Beta]
v2.0-beta - 24 Aug 2023
This is a pre-release, docs are available at beta.leafphp.dev
Added
- Added support for regex rules
- Add support for array validation using
array(...)
- Added a new set of rules for validation (view the docs)
- Added case support for
{field}
template - Added
{value}
template - Added
test()
method to check if data meets a condition - Added
rule()
method - added
message()
method
Changed
- Validation doesn't rely on Leaf Request
- You are now required to pass in data you want to validate
- Successful validation returns the validated data
Removed
- Removed
sanitizeInput()
method - Removed
validateField()
method - Removed
body()
method - Removed
get()
method
π’ Pipeline '2'
v1.2.1 - 16 July 2022
Fixed
- Updated dependency versions
π’ Pipeline
v1.2 - 27 February, 2022
Added
added support for functional mode
Just like most of leaf's modules, leaf form now supports functional mode. This means that you can call form
from anywhere in your application.
form()->errors();
inline validation
This version allows you to quickly perform some checks without having to use arrays in your code.
form()->validate('name', 'required');
added date validator
Leaf form now allows you to validate whether a string is a valid date or not.
form()->validate('joined', 'date');
custom error messages
This has been one of the most sought after features in leaf form, and now it comes pre-packaged in this version. Using custom error messages, you can take your app a step further with multilingual support.
form()->messages('nospaces', '{field} no puede contener espacios');
Note the use of {field}
. This is a mini template that tells leaf to replace {field}
with the current field. So in this case:
$validation = form()->validate('firstname', 'nospaces');
{field}
will be replaced with firstname
. Leaf form also supports {value}
and {params}
which are basically the value of the field being checked and parameters passed into the current rule if any.
Fixed
- fixed broken
nospaces
check - Fixed wrong phpdoc references
πΎ Field
v1.1 - 24 Jan, 2022
Added
- added strict types
Fixed
- fixed request error
Changed
- updated minimum stability
- refactored leaf form
- updated leaf http
- refactored rules