PHP.GT

Latest releases

DomTemplate: Usability improvements

Published on by Greg Bowler

Typehints have been made less strict in some areas, so objects or associative arrays can be used as the data.

The bind function has been introduced as an alias to the bindKeyValue function.

In the binding of list items, the data is bound to the nodes after they are inserted into the DOM to avoid incorrect referencing issues after complete.

Dom: Optional value attribute on select's options

Published on by Greg Bowler

If a select element has option children that do not have the value attribute, getting or setting the value property would previously fail due to a TypeError. The expected behaviour is to fall back to the value of innerText, which is how it is treated in this release. Tests have been updated to check this behaviour.

Input: "or" function

Published on by Greg Bowler

On top of the call functionality, it is now possible to set a callback function to call when the current input trigger is not triggered.

Csrf: Random bytes

Published on by Greg Bowler

Utilising PHP’s inbuilt random_bytes function allows us to drop the large dependency tree that came with random_lib that we were depending on before. This makes a significant improvement to the amount of dependencies that are shipped along with WebEngine.

The standard “asArray” function is added in this release too, increasing consistency with other PhpGt repositories.

Fetch: Stable release

Published on by Greg Bowler

The last few weeks have seen many PHP.Gt repositories reach stable release, and as Fetch was dependent on a few core repositories, is has finally got a clear dependency tree of stable repositories through Composer.

Curl: GetInfo's return type loosened

Published on by Greg Bowler

Currently the return type of Curl::getInfo is set to be integer, but actually there may be any sort of mixed types returned, depending on the info requested.

Http: Stable release

Published on by Greg Bowler

PSR-7 is a far reaching set of interfaces, but their implementation within this repository has been satisfactory for PHP.Gt development for a number of months, so a stable release is being made to allow for PHP.Gt/WebEngine v3 release.

Build: Stable release

Published on by Greg Bowler

The humble build script has a simple responsibility: to execute commands when files change on disk. This functionality has not been altered for many weeks now, while test WebEngine applications have been built and run, so today marks the first stable release of PHP.Gt/Build.

The stable release is being made to unlock the ability of a full stable v3 release of PHP.Gt/WebEngine.

Server: Stable release

Published on by Greg Bowler

There hasn’t been much development on this repository because it has such a simple responsibility: to run the inbuilt PHP webserver, using go.php as the router script.

It’s been included in the PHP.Gt/Installer package for months now, so a stable release is due to unlock WebEngine’s stable v3 release.

DomTemplate: Stable release (with bindable DOM)

Published on by Greg Bowler

Before a stable release could be made, the way that data was bound to the DOM needed to be addressed. Currently (v0.6.x) this was too complex, because no matter what type of data you had, everything was bound to the DOM through the Element::bind() function. That included key value pair storage, lists, and if there was data that needed to be bound to a nested list it was impossible to bind without iterating over it yourself.

The stable release introduce introduces, amongst a generous amount of bugfixes and test hardening, the addition of the following new functions:

  • bindKeyValue
  • bindData
  • bindList
  • bindNestedList

They should be self-explanatory now, and depending on the data that you wish to bind to the page, should be very obvious as to which function you should be calling.

Have fun, and stay productive!

Cron: Stable release

Published on by Greg Bowler

Running your crontab during local development has proven to be extremely useful over the last few WebEngine projects that have been developed on internally.

Since the introduction of the last missing feature, the –now flag, there is no vital functioanlity outstanding preventing this repository from being marked as stable… so here it is, version 1.0.0 of the PHP cron runner.

Have fun, and stay productive!

Config: Stable release

Published on by Greg Bowler

This repository has been in use within many WebEngine applications over the last few months without any change to functionality, so to aid the release of the stable v3 release of WebEngine, Config is getting its first stable release.

DomTemplate: DocBlocks

Published on by Greg Bowler

Throughout the repository, all classes have received PHP Doc Block comments to describe to IDEs what types are being returned by inherited functions. This is required because of the use of DOMDocument::registerNodeClass, which has some unusual side effects with the way classes are inherited in the DOM.

Dom: Improvements to Attr class

Published on by Greg Bowler

The Attr class has received typehints for the Node types it returns, and the introduction of Attr::remove() adds a missing functionality not shared by Element::remove()

Dom: Introduction of Php.Gt's own CSS translator

Published on by Greg Bowler

The major change featured in this release is the introduction of PHP.Gt/CssXPath - our own CSS to XPath translator, meaning we can remove the huge dependency tree of Symfony Components and concentrate on a much more terse and efficient codebase.

All current v1 unit tests have been kept with the introduction of our own translator, so in theory there will not be any backwards-breaking changes, but theory is only ever as good as its latest observation. Please let us know using the issue tracker if this release affects your codebase (also, let us know if it has a positive effect - we’d love to hear from you).

Other notable changes in this release include:

  • All typehints are updated so that all LibXML functions that return native DOMDocument objects now know about the Gt/Dom extension objects (the same can be said with the PHP.Gt/DomTempalte repository too!)
  • In minimal HTML5 documents, a missing <body> tag will be automatically inferred, as is the same in web browsers
  • All element attributes can be set by using live properties, which was a missing feature in v1. A common example of this is setting the “href” attribute of a link: $link->href = "/page"; versus the longhand $link->setAttribute("href", "/page");
  • Following on from that point, special properties are now handled correctly, such as the way only a single radiobutton in the same group can have its checked property set to true.

Please feedback to the contributors how you find this release, either through the issue tracker, or drop a message to dom@php.gt

Have fun and stay productive!

CssXPath: Stable release

Published on by Greg Bowler

With the push to release PhpGt repositories to their stable versions, this release includes the single piece of functionality that was holding it back from being integrated within WebEngine: the ability to assign a prefix to the XPath query.

This is used within the PhpGt/Dom repository to allow typical child-based searches, but also parent-based searches for using DOM functionality such as $element->closest($selector).

The library has been in use within WebEngine for a number of weeks so is receiving its first stable release, and even though advanced functionality like :not selector is missing right now (and admittedly, doing advanced CSS selectors within your server-side code is probably a bad idea), we’re looking forward to adding more completeness to the library for future releases.

Have fun and stay productive!

Session: Stable release

Published on by Greg Bowler

This repository has been in use within WebEngine applications for the last few months with no changes to functionality. With the focus being on a stable v3 release of PhpGt/WebEngine, this release is rather boring - just a bump in dependencies and removal of the “dev” minimum stability flag.

Cli: Stable dependencies

Published on by Greg Bowler

PhpGt/Cli depends on PhpGt/Daemon, which has received its first stable release, meaning that this repository no longer has to specify dev-master in its composer.json.

Daemon: Stable release

Published on by Greg Bowler

This release is actually quite boring. There is no new functionality, and no bugfixes, just the addition of a readme file.

The Daemon repository has been in use in PHP.Gt projects for the last few months untouched. There is no planned new functionality, so there is no reason not to release a v1 stable release! Sometimes, boring is good.

Have fun, and remember to use the issue tracker if you have any problems.

CssXPath: Multiple CSS selectors, comma separated

Published on by Greg Bowler

Part of the CSS specification is the ability to match multiple selectors as one, separated by a comma. This has now been implemented in this repository by splitting the input string on a comma and converting to multiple XPath queries that are chainable.

Amongst this feature, unit tests and continuous integration platforms have been upgraded to the latest versions, and unit tests have been hardened.

Cli: June 2019 minor improvements

Published on by Greg Bowler

No new functionality is being introduced in this release, but plenty of backwards-compatible improvements, such as:

  • Fixed bug where arguments with no value must be passed only at the end of the arguments list
  • Full documentation is output in the --help command
  • All processes take advantage of the PHP.Gt/Daemon repository
  • Use in/out/err streams by default (no need to specify)

Cron: Argument processing improvements

Published on by Greg Bowler

Utilising new functionality from PHP.Gt/Cli upstream, arguments on commands can now be nullable, which has the major improvement of not having to pass arguments with no value at the end of the argument list.

Terminology has been changed in this release to introduce --watch and --now. The watch argument continues the cron execution forever (similar to how PHP.Gt/Build works), and the now argument runs all cron tasks at the start of the execution, which is very useful when developing locally.

Installer: Simplification and organisation of commands

Published on by Greg Bowler

The way that commands are loaded in Cli applications has been improved and the changes from PHP.Gt/Cli have been implemented here.

Abstract WebEngine commands have been introduced which allow the gt commands to be called without any repetition of code.

Csrf: Only protect POST requests

Published on by Greg Bowler

By default this library was protecting against all types of incoming request, by injecting the token into all forms on all pages. However, not only is protecting against CSRF attacks on GET requests not necessary, it can actually cause issues by exposing CSRF tokens in the URL when forms are submitted.

This lead to issues with browsers back/forward buttons triggering expired tokens, which is not expected behaviour of any sort of application.