PHP.GT

Latest releases

DomTemplate: Select binding by value

Published on by Greg Bowler

Along with some dependency upgrades, the extra functionality introduced in this release allows an HTMLSelectElement to have its value bound, so the relevant HTMLOptionElement is selected. This works using the value attribute whether or not the option has a value - without a value, the textContent of the option will be used.

DomTemplate: Binding tweaks

Published on by Greg Bowler

In this minor patch release, there are two improvements:

  • Table bind attributes like data-template-key are removed during the cleanBindAttributes() call.
  • Strings that contain names of inbuilt PHP functions are not treated as “callable” types when binding values.

DomTemplate: Improvements to table binding with existing content

Published on by Greg Bowler

When a <table> element already exists on the page, it would be useful to utilise the contents of the table, retaining parts of it as a template when binding.

This minor release introduces improvements to help this case:

  • Existing <th> elements that don’t match any bound data are preserved.
  • Bound data that doesn’t match any existing headers is discarded.
  • Importantly: existing <tr> elements can be marked with data-template to add pre-templated row shapes for advanced designs.

DomTemplate: Tidying up

Published on by Greg Bowler

The following tweaks have been made to this minor patch release:

  • null values can now be bound everywhere, without an exception being thrown.
  • Internally, the term Modular has been renamed to Partial to reflect the actual usage and documentation.
  • Another terminology change, cleanBindAttributes is renamed to cleanDatasets to better reflect what the function does.
  • Examples are added to the source code for helping developers get used to the library.

Dom: Add fixes to be compatible with PHP 8.1

Published on by Greg Bowler

Massive thanks to @andrewbess for this improvement to the v2 release.

  • The composer dependencies have been updated to be compatible with PHP 8.1
  • Added fixes for extension have been compatible with PHP 8.1
  • build: normalise dependency versions

Session: Minor improvements

Published on by Greg Bowler

In this minor patch release:

  • Dependency updates
  • Improvements to unit tests
  • Use PHP’s internal serialisation for session data

Csrf: DOM v3

Published on by Greg Bowler

PHP.Gt/Dom is now upgraded to v3, which brings a lot of improvements to the compatibility with W3C spec. The good news is that the existing functionality isn’t changed at all, so the one single change that was needed to make Csrf compatible with this new version was to drop the saveHTML() function call of the Document object and replace it with a string cast.

Have fun!

DomTemplate: Callbacks to bindList, performance improvements, BindGetter and more!

Published on by Greg Bowler

This release is packed with small updates:

  • bindListCallback is introduced that allows a callback function to be called on each iteration of the binding of a list, allowing you to mutate the data per element, along with manually tweaking the templated HTMLElement.
  • BindableCache is introduced that significantly increases the speed of using Bind attributes.
  • Wherever a bindable object is used, if it has an asArray function, it will always be called.
  • It’s now possible to leave a custom component empty without an exception being thrown.
  • Overall, unit tests have been strengthened significantly.

DomTemplate: BindData objects

Published on by Greg Bowler

In this minor patch release, bindData() will now check for all objects’ Bind attribute, adding to the flexibility of throwing an object to a Document for binding to the HTML.

Sync: CI and type safety

Published on by Greg Bowler

This patch release improves static analysis by introducing stricter types, along with bumping the version of php-actions scripts that are used for CI.

Build: Efficiency improvement

Published on by Greg Bowler

Prior to this release, tasks would execute for every file that changed in the matched glob, but this lead to unnecessarily repeating the workload. Now, the behaviour is more expected: one task execution when any matched files change. This is much more efficient, and still allows the developer to choose individual task executions by providing more specific glob patterns.

Have fun!