Skip to content

Releases: salient-labs/toolkit

v0.99.20

14 May 02:40
v0.99.20
07d71fd

Choose a tag to compare

Added

  • Add --collapse option to sli generate commands

Changed

  • In CliOption, validate positional option names, discarding long and short if given
  • Rename methods for clarity:
    • CliOption::getValueName() -> CliOption::getValueNameWords()
    • CliOption::formatValueName() -> CliOption::getValueName()
  • Improve CliCommand annotations for downstream static analysis

Fixed

  • Fix Cli issue where escapes in help message content are not always honoured
  • Fix ConsoleFormatter::formatTags() issue where escapes are not reinstated correctly
  • In sli generate commands, only use Differ if sebastian/diff is installed

v0.99.19

13 May 02:51
v0.99.19
a80e9da

Choose a tag to compare

Added

  • Add CliCommand::checkOptionValues()

v0.99.18

03 May 15:22
v0.99.18
bc6cfe6

Choose a tag to compare

Fixed

  • Fix return type regression in CollectionInterface::find()

v0.99.17

03 May 14:28
v0.99.17
608d7ad

Choose a tag to compare

Added

  • Add Process methods pipeInput(), setCwd(), setEnv(), setTimeout (), disableOutputCollection(), enableOutputCollection(), isTerminatedBySignal()
  • Add Sys::isProcessRunning()

Changed

  • In Process and Sys::handleExitSignals(), use exit status 128 + <signal_number> when processes are terminated by signal
  • Review Process:
    • Update constructor and withShellCommand() parameters
    • Replace null input with an empty stream (STDIN must now be passed explicitly via pipeInput())
    • Improve robustness and precision of timeout handling and process termination
    • In runWithoutFail(), throw ProcessFailedException when a process returns a non-zero exit status
    • Throw ProcessTerminatedBySignalException when a process monitored by wait() is terminated by a signal that isn't a SIGTERM or SIGKILL sent after calling stop()
    • Throw LogicException instead of ProcessException where appropriate
    • Build out getStats() metrics
  • Create key-value pairs for CollectionInterface::CALLBACK_USE_BOTH ([<key>, <value>] instead of [<key> => <value>])
  • Optionally return key from CollectionInterface::find()
  • Throw PSR-18 compliant exceptions from Curler::sendRequest()

Removed

  • Remove unused Sys::sqliteHasUpsert()

Fixed

  • Fix Process output collection bugs

v0.99.16

30 Apr 12:45
v0.99.16
f3cc2db

Choose a tag to compare

Added

  • Add CurlerInterface::withUri()
  • Add getHeaderValues() and get{First,Last,One}HeaderLine() to CurlerInterface and HttpMessageInterface
  • Add LinkPager

Changed

  • Adopt "PHPDoc" nomenclature instead of "PhpDoc"

Fixed

  • Fix invalid Inflect::format() syntax in Curler

v0.99.15

29 Apr 10:40
v0.99.15
676af50

Choose a tag to compare

This release includes a backward-incompatible rewrite of Curler, the toolkit's HTTP client, with PSR-7 and PSR-18 support, stackable middleware and many other improvements.

Curler-specific changes include:

  • Implement CurlerInterface and remove magic properties
  • Update CurlerBuilder methods
    • baseUrl() -> uri()
      • now accepts UriInterface|Stringable|string
    • cacheResponse() -> cacheResponses()
    • cachePostResponse() -> cachePostResponses()
    • expiry() -> cacheLifetime()
      • not nullable
      • -1 now means "suppress response caching"
      • cacheResponses() must also be called
    • flush() -> refreshCache()
    • responseCacheKeyCallback() -> cacheKeyCallback()
      • callback now receives HttpRequestInterface and returns string[]|string
    • responseCallback()
      • use middleware() instead
    • connectTimeout() -> timeout()
    • timeout()
    • cookieCacheKey() -> cookiesCacheKey()
    • preserveKeys() -> queryFlags()
      • now accepts bitmask of QueryFlag::*
    • objectAsArray() -> jsonDecodeFlags()
      • now accepts bitmask of JsonDecodeFlag::*
  • Refactor pagination-related interfaces and classes:
    • ICurlerPager -> CurlerPagerInterface
    • ICurlerPage -> CurlerPageInterface
    • CurlerPage
    • ODataPager
    • QueryPager
  • Refactor exceptions:
    • CurlerException -> AbstractCurlerException
    • CurlerCurlErrorException -> CurlErrorException
    • CurlerHttpErrorException -> HttpErrorException
  • Remove:
    • CurlerProperty (obsolete)
    • CurlerPageBuilder (unnecessary)
    • CurlerInvalidResponseException (obsolete)
    • CurlerUnexpectedResponseException (obsolete)

Added

  • Add and implement HttpHeadersInterface::getHeaderValues()
  • Add HttpHeaders methods:
    • from() (static, accepts MessageInterface|Arrayable|iterable|string)
    • getContentLength()
    • getMultipartBoundary()
    • getPreferences()
    • getRetryAfter()
    • mergePreferences()
  • Add and implement HttpMessageInterface::fromPsr7()
  • Add and implement HttpMultipartStreamPartInterface::withName()
  • Add HttpMultipartStreamPart::fromFile()
  • Add HttpStream::fromData()
  • Add StreamEncapsulationException and throw it when multipart data cannot be JSON-encoded
  • Add HttpRequestHandlerInterface (client-side equivalent of PSR-15 MiddlewareInterface)
  • Add CurlerMiddlewareInterface
  • Add HasHttpHeaders trait
  • Add Get::data() and Get::formData()
  • Add Http methods:
    • getDate()
    • getParameters()
    • mergeParameters()
    • getProduct()
    • unquoteString()
  • Add Process methods needed for unit testing
    • Allow processes to be monitored via poll() and stopped via stop()
    • Allow Process output to be read incrementally via getNewOutput() and discarded via clearOutput()
    • Only remove trailing newlines from Process output retrieved via getText() and getNewText()
    • Return Process statistics via getStats() (only spawn_us initially)
  • Add and adopt LogicException and OutOfRangeException

Changed

  • Extend HttpMultipartStreamPart from CurlerFile and refactor
  • Extend Stringable from HttpHeadersInterface
  • In HttpHeadersInterface::getLines(), add support for non-standard empty header syntax (e.g. libcurl's) via optional $emptyFormat parameter
  • In HttpHeaders methods getFirstHeaderLine(), getLastHeaderLine() and getOneHeaderLine(), return the requested value after combining header values and splitting the result
  • Rename Http classes and interfaces for consistency
  • Review HTTP message constructor signatures
  • Accept HTTP protocol versions other than 1.0 and 1.1, including single-digit variants
  • Don't set Content-Length when creating HTTP message payloads
  • Allow HttpServer callback to return ResponseInterface instead of HttpResponseInterface
  • Rename Http::getQuotedString() to Http::maybeQuoteString() and suppress quoting if the string is a valid HTTP token
  • Improve nested object handling in Get::query()
    • Apply an optional callback to objects other than DateTimeInterface instances
    • Skip values for which the callback returns null
    • Resolve Arrayable and Traversable objects to lists
    • Convert JsonSerializable and Jsonable objects to JSON and decode
    • Convert other objects to arrays that map public property names to values
    • Cast Stringable objects with no public properties to string
  • Allow Process output collection to be disabled
  • Allow Process timeout to be given as a float
  • Rename Str::splitOutsideBrackets() to Str::splitDelimited() and add optional support for preservation of double- and single-quoted substrings (for robust HTTP header value splitting)
  • Review Str::split*() default values and signatures to better reflect prevailing usage
  • Make PipeInterface invokable for consistency with HttpRequestHandlerInterface
  • In ExceptionInterface, rename getDetail() to getMetadata() and relax return type

Removed

  • Remove unnecessary HttpProtocolVersion enumeration
  • Remove problematic HttpMessageInterface::withContentLength()
  • Remove inconsistently applied $preserveKeys parameter from Get::array()

Fixed

  • Remove return type from __toString() in the Stringable polyfill for better compatibility with the native class, which doesn't require an explicit return type because __toString() gets one internally
  • Fix issue where ExceptionTrait::withExitStatus() is unusable because exceptions cannot be cloned
  • Fix issue where MultipleErrorExceptionTrait doesn't handle empty messages correctly
  • Annotate HasBuilder to satisfy static analysis in non-final classes

v0.99.14

11 Apr 18:16
v0.99.14
265ba09

Choose a tag to compare

Added

  • Add optional $withResourceUsage parameter to Console::summary()
  • Add optional $delete parameter to File::pruneDir()
  • Add Arr::set(), Arr::unset(), Arr::upperFirst()
  • Add File::checkEof(), File::getLines(), File::isStream(), File::maybeOpen(), File::maybeWrite(), File::readAll(), File::writeAll()
  • Add Get::closure()
  • Add HasImmutableProperties::withoutProperty()
  • Add Regex::INVISIBLE_CHAR
  • Add Test::isAsciiString()
  • Add HttpHeaders methods get{First,Last,One}HeaderLine(), hasLastLine()
  • Add HttpMessage::getHttpPayload(), HttpMessage::__toString()
  • Add HttpStream::copyToStream(), HttpStream::copyToString() after renaming Stream
  • Add HttpMultipartStream
  • Add UploadedFile (PSR-7 implementation)
  • Add Uri::isAuthorityForm()
  • Add Http::getQuotedString() and Http::escapeQuotedString() (new class)

Changed

  • Replace HttpResponse and HttpServerRequest with PSR-7 implementations
  • In Uri:
    • Disable strict URI parsing by default
    • Don't normalise URIs implicitly
    • Optionally replace empty paths with "/" in HTTP URIs
    • Optionally collapse multiple slashes in URIs
    • Make Uri::parse() fully compatible with parse_url()
  • In HttpMessage and HttpHeaders, implement JsonSerializable and scaffold HAR-compliant output from jsonSerialize()
  • Refactor HttpServer for API consistency and more robust request handling
  • Rename Stream to HttpStream
  • Don't cache stream size in HttpStream
  • Don't rewind or truncate streams in File::copy()
  • Remove optional recursion from File::deleteDir()
  • Move File::guessIndentation() to Indentation::from()
  • Rename File methods:
    • existing() -> closestExisting()
    • readCsv() -> getCsv()
    • getCwd() -> getcwd()
    • getSeekable() -> getSeekableStream()
    • isPhp() -> hasPhp()
    • creatable() -> isCreatable()
    • isSeekable() -> isSeekableStream()
    • resolve() -> resolvePath()
    • dir() -> sanitiseDir()
    • putContents() -> writeContents()
    • fputcsv() -> writeCsvLine()
  • Rename Test methods:
    • isBoolValue() -> isBoolean()
    • isIntValue() -> isInteger()
    • isFloatValue() -> isFloat()
    • isPhpReservedWord() -> isBuiltinType()
  • In Get::code():
    • Add $constants parameter that maps substrings to constant identifiers
    • Do not escape CR or LF in multiline mode
    • Do not escape UTF-8 leading or continuation bytes
    • Always escape control characters
    • Escape blank/ignorable characters
    • Remove unnecessary backslashes
    • In arrays with string and integer keys, suppress numeric keys if they are numbered consecutively from 0
  • Accept iterable in Arr::toIndex() and Arr::toMap()
  • Remove Arr::trimAndImplode() in favour of Arr::implode() with optional $characters
  • In EventDispatcher, reject calls to methods other than dispatch() when a listener provider is given
  • Move Curler::mimeTypeIs() to new Http utility class and rename to mediaTypeIs()
  • In Http::mediaTypeIs(), support more suffixes (e.g. +xml) and improve standards compliance
  • Rename Str::splitAndTrim() to Str::split()
  • Merge Str::splitAndTrimOutsideBrackets() into Str::splitOutsideBrackets()
  • In PhpDoc, add support for closure templates and recognise @template syntax as <type> in addition to of <type>
  • Improve unified diff formatting

Removed

  • Remove $lastValueOnly parameter from HttpHeaders::getHeaderLine()

Fixed

  • Fix Get::filter() issue where keys are URL-decoded
  • Fix Get::query() issue where nested arrays may lose their structure
  • Fix issue where Process::wait() fails after process terminates
  • Fix HttpRequest issue where authority-form request-targets cannot be applied
  • In HttpRequest, accept arbitrary request methods and preserve their original case in all contexts
  • In HttpHeaders::addLine(), reject invalid line folding if $strict is true

Security

  • Always chmod() after mkdir() in case umask modifies permissions

v0.99.13

19 Mar 14:03
v0.99.13
1646d46

Choose a tag to compare

Added

  • Add File methods:
    • maybeRewind()
    • maybeSeek()
    • truncate()
    • getSeekable()
  • Add Str::trimNativeEol()

Changed

  • Add PHPStan return type extensions for Str::coalesce() and Get::coalesce(), and allow them to be called with no arguments
  • Add optional $offset parameter to File::getContents()
  • Optionally truncate target streams in File::copy()
  • Move methods from Salient\Contract to other namespaces (coverable code does not belong in contract namespaces)
  • In Process:
    • Allow a process to run more than once
    • Allow process output to be passed to a callback as it is received
    • Add Process::setInput(), Process::setCallback()
    • Split Process::run() into run(), start() and wait()
    • Trim trailing native EOL sequences by default

Removed

  • Remove unused Assert class and related classes

Security

  • Fix File::createDir() and File::createTempDir() issues where permissions are not applied on Windows

v0.99.12

13 Mar 14:04
v0.99.12
5eb65f6

Choose a tag to compare

Added

  • Add File::chmod()
  • Add File::existing()
  • Add File::readLine()
  • Add File::rewind()
  • Add File::size()
  • Add File::type()
  • Add stream-to-stream support to File::copy()
  • Add Process::withShellCommand()

Changed

  • Rename File::cwd() to File::getCwd()
  • Optionally change file modes if necessary for deletion to succeed in File::deleteDir() and File::pruneDir()
  • Improve error reporting in File

Fixed

  • Fix issue where File::createTempDir() tries to create a temporary directory in / if $directory is an empty string

Security

  • Fix File::createDir() issue where permissions are not applied on Windows and may be affected by process umask on other platforms

v0.99.11

08 Mar 00:20
v0.99.11
65efa93

Choose a tag to compare

Changed

  • Rename AbstractTypedCollection::clone() to copy() and include it in CollectionInterface
  • Rename AccessTokenInterface::getType() to getTokenType()
  • Reverse order of first two parameters in HttpRequest::__construct() for consistency with PSR-17 RequestFactoryInterface::createRequest()

Fixed

  • Fix Curler issue where empty responses are incorrectly parsed as JSON