PHP.GT

Latest releases

Curl: Destructing objects after using callback functions

Published on by Greg Bowler

Certain Curl callback functions such as the Header, Progress, Read and Write functions can cause the underlying Curl resource to destruct. This is by the design of Curl, but if this happens while using the OOP wrapper that this repository provides, an error is raised when the object destructors fire, because the underlying resource is no longer present.

DomTemplate: Improvements to tests

Published on by Greg Bowler

PHPUnit 8 has been introduced and tests adjusted accordingly. Continuous Integration services are now updated to work with the latest version of PHP.

Session: June 2019 minor improvement

Published on by Greg Bowler

When referring to Session namespaces, if a namespace hadn’t been initialised, the library would fail. Now an empty store is created before any additions/removals of stores are called, fixing the error caused by the uninitialised variable.

Amongst this bugfix, PHPUnit has been bumped to latest version.

Http: Stream improvements

Published on by Greg Bowler

Functionality has been slightly modified after introducing unit tests for working with Streams in the following ways:

  • String representation of Stream objects
  • Detaching a stream’s resource object mid-use
  • Tell, Eof, Seek methods
  • Writing to Streams sequentially
  • Accessing Stream metadata
  • Getting stream contents in one operation

Dom: Input "multiple" and "selected" properties

Published on by Greg Bowler

Amongst many updates to the unit tests, this release introduces new tests and functionality for “multiple” select elements, along with proper handling of the “selected” property of checkboxes, radioboxes and selects.

Server: Working prototype

Published on by Greg Bowler

There is very little responsibility to the preamble to v1 of this repository; the server script simply calls PHP’s inbuilt server using php -S 0.0.0.0:8080, with a few settings wrapped using Gt/Cli.

There are plans for implementing a PSR compatible Http Server in this repository, but until then, no further features are planned in the v1 release, so unless any bugs are detected with this implementation, a v1 release will be made when the next product running WebEngine is complete and deployed, as another real-world test.

ProtectedGlobal: Stable release

Published on by Greg Bowler

This very basic core library has been in use within WebEngine and untouched for months now. Any enhancements can be tracked in the issue tracker and added to v2.

Fetch: Blob response type

Published on by Greg Bowler

The 0.7.x releases mark the final steps towards stable release, implementing the other types of response, starting with the blob type.

Implementing the different types has outlined a potential new repository for PhpGt: WebAPI, which would be a collection of the standard objects that make up the W3C WebAPI, such as Blob, ArrayBuffer, etc. For now, these exist within Fetch, because there doesn’t seem to be much use of reusing them on the server elsewhere… yet.

Fetch: CURLOPT from RequestInterface

Published on by Greg Bowler

Calling the fetch method with a PSR-7 RequestInterface is now possible, with the library converting the properties of the Request object to the corresponding CURLOPT settings.

Input: Improved consistency

Published on by Greg Bowler

No new features have been added since v0.4, only consistency improvements. After resolving the final v1 issues from the issue tracker, today marks the release of v1 of the PHP.Gt/Input repository.

Main improvements are:

  • Implementation of PSR 7’s UploadedFileInterface, allowing interoperability between other areas of PHP.Gt using the PHP.Gt/Http repository.
  • asArray - naming compatibility with other PHP.Gt repositories.
  • The Input class is now mutable, allowing extra parameters to be added after initial construction. InputData classes are still immutable, so this allows the framework to add properties without exposing the functionality to user code.
  • Return types of all get* functions are improved for readability and predictability.

Cookie: Array conversion and clearing of cookies

Published on by Greg Bowler

Some areas of code are not always under your control, and if an area of code expects to see the cookies in an associative array call the asArray method.

More importantly, it’s now possible to clear all or specific cookies by using the clear() function, passing in any cookie names that you want to remove.

Sync: CLI application

Published on by Greg Bowler

The bin/sync file is exposed through Composer to allow access to the CLI interface for keeping two directories in sync. CLI i/o is powered by php.gt/cli

Sync: Selective sync

Published on by Greg Bowler

This release introduces a new feature, selective sync, which allows setting a filename pattern (glob) to only sync matching files. The glob being used is provided by @WebMozart’s Glob package, allowing advanced/recursive file matching.

Daemon: Process blocking and exit codes

Published on by Greg Bowler

This release consists mainly of unit tests to improve the coverage, but through testing an issue was caught: proc_open opens a process to the system’s underlying shell – not the actual command being run. Because of this, there is no way to know if the command exists or not. There was a bad assumption written inside the exec function checking on a failed execution, but the failure could never occur. Tests added and functionality adjusted to get around this limitation.

Cli: In-memory streams

Published on by Greg Bowler

This is a minor release consisting of an introduction of default constructor arguments to the Stream object. Now a Stream can be constructed without specifying any particular stream path, in which case the object will use php://memory.

Sync: Code complete

Published on by Greg Bowler

The Sync repository has a simple responsibility: keep two directories in sync. This v1 release marks the 100% code coverage, where real directories are filled with random files, etited, deleted and re-synced to test the functionality behaves as expected.

The main reason this repository exists is to allow PHP.Gt/Build to sync files and folders that do not need compiling, but there are going to be many other use cases of such a simple script out there.

Have fun staying in sync!

Sync: Functionality tested

Published on by Greg Bowler

The PHPUnit tests in this repository act as integration tests too as there is no benefit from mocking everything due to the simple nature of the responsibilities of this area of PHP.Gt.

Still to test:

  • Throwing of configuration errors.
  • Throwing filesystem errors.
  • Getting file list statistics.

Sync: DirectorySync implementation

Published on by Greg Bowler

This super-simple repository has been implemented through exploratory code and will be fleshed out in subsequent commits by unit tests and the implementations required to fulfil them.

Daemon: Initial class implementation

Published on by Greg Bowler

Thanks to Yassine Say @sayyassine9 for the contributions in getting the Daemon repository working on Windows. This repo will be used within the Installer (php.gt/installer) as soon as it reaches v1.

Sync: Abstract Sync class

Published on by Greg Bowler

Introducing an abstract class to perform the sync allows future versions to sync across multiple media, such as SSH, network drive, git, whatever.

Installer: New abstract Command class

Published on by Greg Bowler

To help with readability, all of the behaviours of a Command must now be defined in the return of new get* functions on the base Command class.

This avoids having to remember all of the possible options to perform in the constructor. New functions include:

  • getName
  • getDescription
  • getRequiredNamedParameterList
  • getOptionalNamedParameterList
  • getOptionalParameterList
  • getRequiredParameterList

Cli: ArgumentValue improvements

Published on by Greg Bowler

This is a minor update with two small improvements to the ArgumentValue class.

  1. ArgumentValue objects can now be treated as strings
  2. Default values are set correctly

SqlBuilder: Base-logic tested

Published on by Greg Bowler

After a few coding explorations, the general layout and workflow of SqlBuilder have been defined. Every type of query extends the abstract SqlBuilder class. These extensions, such as SelectBuilder will also be abstract, expecting to see developers’ classes implement a concrete extension.

Following releases will mark the different types of Builder for Update, Delete, Insert.

Cli: Default commands

Published on by Greg Bowler

If an application is intended to be run by just its name, like build (rather than requiring build run or build exec or build do-the-one-thing-this-application-is-built-for), a default command can be set, so that the application can be run without needing a command specified by the user.