The was.php PHPy package packs some common support libraries used by various Wizardry and Steamworks assets.
| Branch | Function Prototype | Documentation | Description |
|---|---|---|---|
| IO | atomized_put_contents($file, $data) | Atomic write to a file. | |
atomized_get_contents($file) | Atomic read from a file. | ||
| collections | wasArrayStride'($a, $s) | array stride | Returns every -th element in array a. |
| formats/csv | wasCSVToArray($csv) | Converts an RFC 4180 compilant CSV string to a PHP array. | |
wasArrayToCSV($a) | Converts a PHP array to an RFC 4180 compilant CSV string | ||
| formats/kvp | wasKeyValueGet($key, $data) | Retrieves the value of a key from a key-value pairs string. | |
| mathematics | mapValueToRange($value, $xMin, $xMax, $yMin, $yMax) | map a value from a source range to a destination range | Maps a value from a source range into a destination range. |
| lsl | wasLSLVectorToArray($vector) | Converts an LSL point vector (Vector3d) to a PHP array of components. |
The was.php package can be installed through composer from the Wizardry and Steamworks private repository. Create a file in the project folder named composer.json and add the repository:
{
"repositories": {
"was": {
"type": "composer",
"url": "https://satis.grimore.org"
}
},
"minimum-stability": "dev"
}
After that, the package can be installed by issuing:
composer require was/utilities
To use any of the functions, just include the PHP file using require_once.