PHP.GT

Latest releases

Cron: Stream reworking

Published on by Greg Bowler

The stream property is renamed to output, and now streams are injected into the Command constructor.

Cron: Comments in crontab

Published on by Greg Bowler

Comments can be added to the crontab file. Any lines that start with a hash (#) will be ignored when reading.

Csrf: HTMLDocumentProtector only protects POST forms

Published on by Greg Bowler

Up to this point, HTMLDocumentProtector’s protectAndInject method added CSRF tokens to all forms, regardless of method.

Having CSRF tokens on GET requests doesn’t lead to a good user experience (and is not protecting you against anything). Once a form is submitted with a GET request, the token is added to the URL, which means that visiting the URL again (or simply refreshing the browser) causes the protection to throw an exception because the token has already been consumed.

There is no need to protect against CSRF on GET requests anyway, because GET requests should never affect the state of an application.

ProtectedGlobal: $GLOBALS replaced in-place

Published on by Greg Bowler

$GLOBALS are passed by reference into the removal function so that the returned array can be used to set the other superglobals while protecting them.

Rather than protecting each global variable in place, the $GLOBALS superglobal is used when setting the whitelists, and when protecting the other variables.

Fetch: Recursive promise fulfilment

Published on by Greg Bowler

The issue that was being tracked by #28 is now resolved. The response of a promise’s fulfilment could also be a promise, which was in turn not being fulfilled.

Now a recursive check is made to ensure all promises are called in the current chain.

Database: December 2018 update

Published on by Greg Bowler

Many small patches and more test coverage.

Main features:

  • Arrays can be used as parameter bindings, automatically concatenated with commas.
  • Countable ResultSet bug fixed.
  • Iterating the ResultSet does not persist the internal pointer position.
  • Refactoring of special bindings code.

Csrf: Removed mixtures of static/non-static members

Published on by Greg Bowler

An important point in the styleguide is to never mix static and non-static members within the same class.

While the code itself worked fine, the problems were made apparent when PHPUnit runs tests concurrently – it became difficult to understand having state encapsulated within an object for one property when shared amongst all objects for another.

Because of the slight change to API, this release is a minor version increase as opposed to a patch.

Csrf: Full test coverage

Published on by Greg Bowler

As part of the effort of getting the codebase 100% tested, many small changes have been made which are all very minor.

There is one more backwards-breaking change planned which will be released in 1.3.0.

DomTemplate: Consistency and stricter types

Published on by Greg Bowler

Consistency has been improved with other PHP.Gt repositories, specifically the use of “contains” over “has” to match other DOM APIs.

Type checking has been made safer with the use of the null coalescing operator rather than emitting warnings or throwing errors.

Input: File upload improvements

Published on by Greg Bowler

Simplification of how Input handles file uploads. There will probably be more small changes made as the FileUpload classes are tested fully.

The InputValueGetter trait has also been introduced, which allows the Input class to be used as if it were InputData itself.

Cli: Refactoring for test coverage

Published on by Greg Bowler

When starting an open source repository, v0.0.x releases often contain exploratory code. This release marks the refactoring done to smooth out the code structure and define the classes that will be used for the v1 release.

Main changes:

  • Exceptions introduced
  • Argument abstract class shared amongst different types of Argument
  • Main run function simplified

Cron: 100% test coverage

Published on by Greg Bowler

Having 100% test coverage doesn’t mean a product works fully, and this is proof of that (hence the pre-release 0.0.5 version number).

Everything so far has been fully tested, but the cron jobs are not runnable yet. This will come in the next feature releases as the CLI Commands are built up.

Cron: Cli application

Published on by Greg Bowler

The basic functionality is bound together with the Php.Gt/Cli library, allowing for user input/output to interact with the cron bin script.

Cron: Sleep between jobs

Published on by Greg Bowler

To optimise the CPU usage, the main loop is delayed for the number of seconds until the next job is due.

Fetch: End-to-end promises with React

Published on by Greg Bowler

This release has added ReactPHP’s Promise library, as it is a very robust solution.

However, it is not compatible with PSR-7, so the coming 0.5.x releases will find a way to have the best of both worlds.

Curl: CurlObjectLookup

Published on by Greg Bowler

Along with the Curl object type being standardised more thoroughly, this release introduces the CurlObjectLookup class, which stores a reference to all initialised Curl objects. The purpose of this is to allow referencing the original Curl object from a native curl handle, which is a requirement when using CurlMulti functionality.

Http: Fetch/Curl usage

Published on by Greg Bowler

Enough of the Interfaces are implemented now to use Fetch/Curl classes that require the PSR-7 interfaces. There are still many functions to implement, which is why this release is considered a patch, rather than minor version, even though there is a lot of new functionality introduced.