tagadvance/gilligan

...

dev-master 2023-12-10 01:48 UTC

This package is auto-updated.

Last update: 2024-04-10 02:33:02 UTC


README

Build Status

Gilligan

Gilligan is a collection of PHP utilities I have created or gathered over the course of my career.

Some of these components are or were "pet projects" that I worked on simply because I thought they would be fun to implement.

The design of some of these tools was heavily influenced by libraries like Apache Commons and Guava.

Download / Install

The easiest way to install Gilligan is via Composer:

composer require "tagadvance/gilligan:dev-master"
{
    "require": {
        "tagadvance/gilligan": "dev-master"
    }
}

Highlights

Standard Print Streams, e.g.

Standard::output()->printLine('foo');
// prints 'foo'

Java-like IO Streams, e.g.

$fileName = 'test.php';
$file = new File( $fileName );
$stream = new FileInputStream( $file );
try {
	$bytes = $stream->read($length = 5);
	Standard::output()->printLine($bytes);
} finally {
	$stream->close();
}
// prints '<?php'

Backward Compatible Session Handlers, e.g.

$defaultHandler = new \SessionHandler();
$pdo = new \PDO($dsn);
$supplier = new EagerPDOSupplier($pdo);
$mysqlHandler = new MySQLSessionHandler($supplier, $remoteAddress = 'localhost');
$cascadeHandler = new CascadeSessionHandler($mysqlHandler, $defaultHandler);
SessionSaveHandler::register($cascadeHandler);
session_start();

StringClass, e.g.

$true = StringClass::valueOf('abcxyz')->startsWith('abc');