Releases: salient-labs/toolkit
Releases · salient-labs/toolkit
v0.99.20
Added
- Add
--collapseoption tosli generatecommands
Changed
- In
CliOption, validate positional option names, discardinglongandshortif given - Rename methods for clarity:
CliOption::getValueName()->CliOption::getValueNameWords()CliOption::formatValueName()->CliOption::getValueName()
- Improve
CliCommandannotations for downstream static analysis
Fixed
- Fix
Cliissue where escapes in help message content are not always honoured - Fix
ConsoleFormatter::formatTags()issue where escapes are not reinstated correctly - In
sli generatecommands, only useDifferifsebastian/diffis installed
v0.99.19
v0.99.18
v0.99.17
Added
- Add
ProcessmethodspipeInput(),setCwd(),setEnv(),setTimeout (),disableOutputCollection(),enableOutputCollection(),isTerminatedBySignal() - Add
Sys::isProcessRunning()
Changed
- In
ProcessandSys::handleExitSignals(), use exit status128 + <signal_number>when processes are terminated by signal - Review
Process:- Update constructor and
withShellCommand()parameters - Replace
nullinput with an empty stream (STDINmust now be passed explicitly viapipeInput()) - Improve robustness and precision of timeout handling and process termination
- In
runWithoutFail(), throwProcessFailedExceptionwhen a process returns a non-zero exit status - Throw
ProcessTerminatedBySignalExceptionwhen a process monitored bywait()is terminated by a signal that isn't aSIGTERMorSIGKILLsent after callingstop() - Throw
LogicExceptioninstead ofProcessExceptionwhere appropriate - Build out
getStats()metrics
- Update constructor and
- 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
Processoutput collection bugs
v0.99.16
Added
- Add
CurlerInterface::withUri() - Add
getHeaderValues()andget{First,Last,One}HeaderLine()toCurlerInterfaceandHttpMessageInterface - Add
LinkPager
Changed
- Adopt "PHPDoc" nomenclature instead of "PhpDoc"
Fixed
- Fix invalid
Inflect::format()syntax inCurler
v0.99.15
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
CurlerInterfaceand remove magic properties - Update
CurlerBuildermethodsbaseUrl()->uri()- now accepts
UriInterface|Stringable|string
- now accepts
cacheResponse()->cacheResponses()cachePostResponse()->cachePostResponses()expiry()->cacheLifetime()- not nullable
-1now means "suppress response caching"cacheResponses()must also be called
flush()->refreshCache()responseCacheKeyCallback()->cacheKeyCallback()- callback now receives
HttpRequestInterfaceand returnsstring[]|string
- callback now receives
responseCallback()- use
middleware()instead
- use
connectTimeout()->timeout()timeout()cookieCacheKey()->cookiesCacheKey()preserveKeys()->queryFlags()- now accepts bitmask of
QueryFlag::*
- now accepts bitmask of
objectAsArray()->jsonDecodeFlags()- now accepts bitmask of
JsonDecodeFlag::*
- now accepts bitmask of
- Refactor pagination-related interfaces and classes:
ICurlerPager->CurlerPagerInterfaceICurlerPage->CurlerPageInterfaceCurlerPageODataPagerQueryPager
- Refactor exceptions:
CurlerException->AbstractCurlerExceptionCurlerCurlErrorException->CurlErrorExceptionCurlerHttpErrorException->HttpErrorException
- Remove:
CurlerProperty(obsolete)CurlerPageBuilder(unnecessary)CurlerInvalidResponseException(obsolete)CurlerUnexpectedResponseException(obsolete)
Added
- Add and implement
HttpHeadersInterface::getHeaderValues() - Add
HttpHeadersmethods:from()(static, acceptsMessageInterface|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
StreamEncapsulationExceptionand throw it when multipart data cannot be JSON-encoded - Add
HttpRequestHandlerInterface(client-side equivalent of PSR-15MiddlewareInterface) - Add
CurlerMiddlewareInterface - Add
HasHttpHeaderstrait - Add
Get::data()andGet::formData() - Add
Httpmethods:getDate()getParameters()mergeParameters()getProduct()unquoteString()
- Add
Processmethods needed for unit testing- Allow processes to be monitored via
poll()and stopped viastop() - Allow
Processoutput to be read incrementally viagetNewOutput()and discarded viaclearOutput() - Only remove trailing newlines from
Processoutput retrieved viagetText()andgetNewText() - Return
Processstatistics viagetStats()(onlyspawn_usinitially)
- Allow processes to be monitored via
- Add and adopt
LogicExceptionandOutOfRangeException
Changed
- Extend
HttpMultipartStreamPartfromCurlerFileand refactor - Extend
StringablefromHttpHeadersInterface - In
HttpHeadersInterface::getLines(), add support for non-standard empty header syntax (e.g. libcurl's) via optional$emptyFormatparameter - In
HttpHeadersmethodsgetFirstHeaderLine(),getLastHeaderLine()andgetOneHeaderLine(), return the requested value after combining header values and splitting the result - Rename
Httpclasses and interfaces for consistency - Review HTTP message constructor signatures
- Accept HTTP protocol versions other than
1.0and1.1, including single-digit variants - Don't set
Content-Lengthwhen creating HTTP message payloads - Allow
HttpServercallback to returnResponseInterfaceinstead ofHttpResponseInterface - Rename
Http::getQuotedString()toHttp::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
DateTimeInterfaceinstances - Skip values for which the callback returns
null - Resolve
ArrayableandTraversableobjects to lists - Convert
JsonSerializableandJsonableobjects to JSON and decode - Convert other objects to arrays that map public property names to values
- Cast
Stringableobjects with no public properties tostring
- Apply an optional callback to objects other than
- Allow
Processoutput collection to be disabled - Allow
Processtimeout to be given as afloat - Rename
Str::splitOutsideBrackets()toStr::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
PipeInterfaceinvokable for consistency withHttpRequestHandlerInterface - In
ExceptionInterface, renamegetDetail()togetMetadata()and relax return type
Removed
- Remove unnecessary
HttpProtocolVersionenumeration - Remove problematic
HttpMessageInterface::withContentLength() - Remove inconsistently applied
$preserveKeysparameter fromGet::array()
Fixed
- Remove return type from
__toString()in theStringablepolyfill 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
MultipleErrorExceptionTraitdoesn't handle empty messages correctly - Annotate
HasBuilderto satisfy static analysis in non-final classes
v0.99.14
Added
- Add optional
$withResourceUsageparameter toConsole::summary() - Add optional
$deleteparameter toFile::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
HttpHeadersmethodsget{First,Last,One}HeaderLine(),hasLastLine() - Add
HttpMessage::getHttpPayload(),HttpMessage::__toString() - Add
HttpStream::copyToStream(),HttpStream::copyToString()after renamingStream - Add
HttpMultipartStream - Add
UploadedFile(PSR-7 implementation) - Add
Uri::isAuthorityForm() - Add
Http::getQuotedString()andHttp::escapeQuotedString()(new class)
Changed
- Replace
HttpResponseandHttpServerRequestwith 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 withparse_url()
- In
HttpMessageandHttpHeaders, implementJsonSerializableand scaffold HAR-compliant output fromjsonSerialize() - Refactor
HttpServerfor API consistency and more robust request handling - Rename
StreamtoHttpStream - 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()toIndentation::from() - Rename
Filemethods:existing()->closestExisting()readCsv()->getCsv()getCwd()->getcwd()getSeekable()->getSeekableStream()isPhp()->hasPhp()creatable()->isCreatable()isSeekable()->isSeekableStream()resolve()->resolvePath()dir()->sanitiseDir()putContents()->writeContents()fputcsv()->writeCsvLine()
- Rename
Testmethods:isBoolValue()->isBoolean()isIntValue()->isInteger()isFloatValue()->isFloat()isPhpReservedWord()->isBuiltinType()
- In
Get::code():- Add
$constantsparameter 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
- Add
- Accept
iterableinArr::toIndex()andArr::toMap() - Remove
Arr::trimAndImplode()in favour ofArr::implode()with optional$characters - In
EventDispatcher, reject calls to methods other thandispatch()when a listener provider is given - Move
Curler::mimeTypeIs()to newHttputility class and rename tomediaTypeIs() - In
Http::mediaTypeIs(), support more suffixes (e.g.+xml) and improve standards compliance - Rename
Str::splitAndTrim()toStr::split() - Merge
Str::splitAndTrimOutsideBrackets()intoStr::splitOutsideBrackets() - In
PhpDoc, add support for closure templates and recognise@templatesyntaxas <type>in addition toof <type> - Improve unified diff formatting
Removed
- Remove
$lastValueOnlyparameter fromHttpHeaders::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
HttpRequestissue 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$strictistrue
Security
- Always
chmod()aftermkdir()in case umask modifies permissions
v0.99.13
Added
- Add
Filemethods:maybeRewind()maybeSeek()truncate()getSeekable()
- Add
Str::trimNativeEol()
Changed
- Add PHPStan return type extensions for
Str::coalesce()andGet::coalesce(), and allow them to be called with no arguments - Add optional
$offsetparameter toFile::getContents() - Optionally truncate target streams in
File::copy() - Move methods from
Salient\Contractto 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()intorun(),start()andwait() - Trim trailing native EOL sequences by default
Removed
- Remove unused
Assertclass and related classes
Security
- Fix
File::createDir()andFile::createTempDir()issues where permissions are not applied on Windows
v0.99.12
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()toFile::getCwd() - Optionally change file modes if necessary for deletion to succeed in
File::deleteDir()andFile::pruneDir() - Improve error reporting in
File
Fixed
- Fix issue where
File::createTempDir()tries to create a temporary directory in/if$directoryis 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
Changed
- Rename
AbstractTypedCollection::clone()tocopy()and include it inCollectionInterface - Rename
AccessTokenInterface::getType()togetTokenType() - Reverse order of first two parameters in
HttpRequest::__construct()for consistency with PSR-17RequestFactoryInterface::createRequest()
Fixed
- Fix
Curlerissue where empty responses are incorrectly parsed as JSON