Skip to content

Releases: leafsphp/form

πŸ”“ YΗ”nxΗ”

09 Nov 03:49
Compare
Choose a tag to compare

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

08 Nov 20:52
Compare
Choose a tag to compare

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

07 Nov 02:57
Compare
Choose a tag to compare

v3.0 - 7 Nov 2024

Added

  • Added new validators like truefalse, numeric, float and hardfloat

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 and contains: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 an optional 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 like array<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 by array<>
  • test() has been replaced by validateRule()

πŸ„β€β™€οΈ Esqui

25 Aug 02:20
Compare
Choose a tag to compare

v2.2 - 24 August 2024

Changed

  • Updated to Leaf's new config API

πŸ‘” Kenshō

12 Nov 23:00
Compare
Choose a tag to compare

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

01 Sep 18:13
Compare
Choose a tag to compare

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]

24 Aug 21:42
Compare
Choose a tag to compare
Pre-release

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'

16 Jul 14:53
Compare
Choose a tag to compare

v1.2.1 - 16 July 2022

Fixed

  • Updated dependency versions

πŸ›’ Pipeline

27 Feb 01:47
Compare
Choose a tag to compare

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

24 Jan 10:04
Compare
Choose a tag to compare

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