• v2.0.0 85b461e441

    v2.0.0 Stable

    danieljsummers released this 2024-11-21 03:46:18 +00:00 | 0 commits to main since this release

    The PHP 8.4 version of this library is now generally available.

    RC 1 required no changes; tests have been migrated to Pest from straight PHPUnit.

    Downloads
  • v1.0.0 3b2d2ced98

    v1.0.0 Stable

    danieljsummers released this 2024-11-21 03:30:35 +00:00 | 0 commits to v1 since this release

    The PHP 8.2/8.3 version of this library is now generally available.

    RC 1 required no changes; tests have been migrated to Pest from straight PHPUnit.

    Downloads
  • v2.0.0-rc1 486028bd40

    v2, RC 1 Pre-Release

    danieljsummers released this 2024-10-02 01:41:57 +00:00 | 2 commits to main since this release

    This version is a PHP 8.4+ change of this library. There are two major API changes:

    • On DocumentList, items and hasItems are now properties rather than functions.
    • In the dependent InspiredByFSharp library, several functions on Option and Result are now properties. See its README for a table with their new APIs.

    Version 1 of this library will continue to be supported, including to a full release status. Making this major revision change is the best way for composer to be able to tell which one should be installed; version 1 requires PHP 8.2 or 8.3, while this library requires 8.4 or greater.

    Downloads
  • v1.0.0-rc1 df436c9ef4

    v1, RC 1 Pre-Release

    danieljsummers released this 2024-10-01 00:31:33 +00:00 | 3 commits to main since this release

    This version fixes a bug where ORDER BY clauses were not generated correctly if the field had a qualifier.

    This version also restricts PHP versions to 8.2.* or 8.3.*. A forthcoming v2 of this library will target PHP 8.4, using properties in some places where functions are currently used. v1 will be supported.

    Downloads
  • v1.0.0-beta10 d067f8983f

    v1, Beta 10 Pre-Release

    danieljsummers released this 2024-09-27 02:30:09 +00:00 | 4 commits to main since this release

    Lots of good stuff here!

    • There are two new field comparisons; in implements an IN comparison against a field, and inArray does the same thing for fields that are themselves JSON arrays.
    • The Find functions (except byId) now support an array of Fields, as their last parameter, which will be used to order the results. There is also a new Field::named() function which can be used to create field definitions for this purpose. These names follow the same rules as other field names (use "a.b.c" for nested fields), but they support other features as well.
      • To sort descending, include DESC in the name (ex. Field::named('code DESC')).
      • To specify a null clause, include it as well (ex. Field::named('example NULLS FIRST')).
      • To sort the field as a number, prefix the field name with n: (ex. Field::named('n:ranking')). PostgreSQL will cast the field to a number, while SQLite will do its usual best-guess.
      • To sort case-insensitively, prefix the field name with i: (ex. Field::named('i:comment')). SQLite's default is case-sensitive sorting, with uppercase values first. PostgreSQL's behavior is based on libraries in the underlying operating system; some are case-insensitive by default, but others (particularly Mac OS) are case-sensitive.
    • The names of the comparisons in Field constructor functions are now spelled out (ex. Field::equal instead of Field::EQ). The two-character versions remain as aliases, so this will not break existing code.
    • The project now comes back clean for PHPStan level 6, and had some changes flagged on higher levels. One of these changes may fix an issue where IDEs were not picking up the generic type coming from DocumentList->items().
    Downloads
  • v1.0.0-beta9 9e0e663811

    v1, Beta 9 Pre-Release

    danieljsummers released this 2024-07-29 20:59:59 +00:00 | 5 commits to main since this release

    This release mostly picks up the updated option/result library. However, the breaking change from beta8 that dropped getOrThrow() from the Options returned from this library is no longer an issue; this library update implements the method.

    Downloads
  • v1.0.0-beta8 039283224a

    v1, Beta 8 Pre-Release

    danieljsummers released this 2024-07-29 00:23:07 +00:00 | 6 commits to main since this release

    BREAKING CHANGE
    The Option implementation has been swapped from PhpOption to BitBadger\InspiredByFSharp. There are a few ways to fix syntax errors that may be encountered:

    • The new library's Option instances have a toPhpOption() method; add that to the end of the option-returning call, and everything should work fine.
    • The new library's Option instances use get() to obtain the value; these calls will not need to change.
    • The new library uses isSome() in place of isDefined(), and isNone() in place of isEmpty().
    • The new library does not (yet) have getOrThrow().

    FEATURE
    DocumentList now has a mapToArray() method; this will map an associative array of key/value pairs from the items in the list. One potential use for this is obtaining a list of IDs and names to generate an HTML <select> element. $lookup = $list->mapToArray(fn($it) => $it->id, fn($it) => $it->name); will generate such an array from a DocumentList instance, with no requirement to create an intermediate array of documents.

    Downloads
  • v1.0.0-beta7 57d8f9ddc1

    v1, Beta 7 Pre-Release

    danieljsummers released this 2024-07-25 01:04:23 +00:00 | 10 commits to main since this release

    It's DocumentList's turn in the spotlight.

    • map(callable(TDoc): U) creates a generator which transforms results rather than returning them directly as items() does.
    • iter(callable(TDoc)) iterates the item list without transformations.
    • items() will now throw a DocumentException if it is called after the generator has been consumed.
    • Finally, there is a section in the documentation dedicated to DocumentList and its usage.
    Downloads
  • v1.0.0-beta6 adbe4e6614

    v1, Beta 6 Pre-Release

    danieljsummers released this 2024-07-22 15:16:08 +00:00 | 12 commits to main since this release

    BREAKING CHANGES:

    • Instead of setting Configuration::$pdoDSN, call Configuration::useDSN() instead. This allows the library to derive its mode based on the data source name (DSN) being set, rather than waiting for the first time a call is made.
    • Related to the above, it should no longer be necessary to set the mode directly. Configuration::$mode is no longer visible.

    I debated making these changes with a beta digit release, but they should be targeted to one or two lines in each dependent application, and I was having trouble justifying the (somewhat convoluted) way it currently worked as I was writing the documentation. Speaking of documentation...

    DOCUMENTATION IS NOW LIVE! This was a "coming during beta testing" to-do list item, and it has now been accomplished. There is much more detail about how to set up and use the library there.

    Downloads
  • v1.0.0-beta5 1a37b009ea

    v1, Beta 5 Pre-Release

    danieljsummers released this 2024-07-04 17:18:01 +00:00 | 15 commits to main since this release

    This fixes a logic flaw in beta 4 around handling empty arrays.

    Downloads