utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

OTHER License

Downloads
232M
Stars
2K
Committers
74

Bot releases are hidden (Show)

utils - Released version 4.0.5

Published by dg 2 months ago

  • Strings::matchAll(): added option 'lazy'
  • added Arrays::mapWithKeys() & Iterables::mapWithKeys()
  • added Iterables::memoize() & toIterator()
  • Image: GD extension detection added
  • support for PHP 8.4
utils - Released version 4.0.4 Latest Release

Published by dg 9 months ago

  • added Iterables
  • added Arrays::firstKey(), lastKey()
  • added Arrays::filter()
  • Arrays::first() & last(): added parameter $else
  • Arrays::first() & last(): added parameter $predicate #305
  • added Image::getSupportedTypes()
  • Arrays: improved phpDoc
  • utilizes Random\Randomizer in PHP 8.3
  • StaticClass: fixed compatibility with PHP 8.3.2
  • Strings::trim() trims unicode spaces and ZWSP (#304)
utils - Released version 4.0.3

Published by dg 12 months ago

  • added ImageColor, replaces Image::rgb()
  • added Image::rectangleWH(), filledRectangleWH(), calculateTextBox()
  • Type: fixed resolving of 'static' nette/di#295
utils - Released version 4.0.2

Published by dg about 1 year ago

  • Strings::length() uses mbstring, iconv and then utf8_decode #299
  • Finder: getType() replaced with isDir() / isFile()
  • StaticClass: constructor is private nette/di#292
  • Arrays: add generic type declaration for some(), every() and map() (#298)
  • FileSystem: can be used as instance
utils - Released version 3.2.10

Published by dg about 1 year ago

  • support for PHP 8.3
  • Callback::unwrap() returns correct class name for private methods
  • improved type annotations (#290)
  • Reflection: getParameterType(), getReturnType() and getPropertyType() marked as deprecated
utils - Released version 4.0.1

Published by dg about 1 year ago

  • support for PHP 8.3
  • added Image::isTypeSupported()
  • added enum ImageType
  • Finder: collect() returns list
  • Finder: improved exception when directory is missing
  • Finder: default mask is '*'
  • improved type annotations (#290)
  • Callback::unwrap() returns correct class name for private methods
utils - Released version 4.0.0 🥳

Published by dg over 1 year ago

  • uses PHP 8 featurs
  • includes a completely rewritten Finder
  • PascalCase constants
  • Strings: added support for UTF-8 offsets in regexp
  • Translator: improved interface, accepts and returns string|Stringable [Closes #231]
  • ArrayHash & ArrayList: support iteration with reference (#289)

new methods:

  • Nette\Utils\Json::decodeFile() reads JSON from a file
  • Nette\Utils\FileSystem::unixSlashes() & platformSlashes() converts slashes to Unix slashes
  • Nette\Utils\Strings::ord(), unixNewLines() & platformNewLines()
  • Nette\Utils\Helpers::compare() compare using the operator

new parameters:

  • Nette\Utils\Strings::split() added parameter $limit
  • Nette\Utils\Strings::replace() added parameters $captureOffset, $unmatchedAsNull
  • Nette\Utils\Strings, Nette\Utils\Arrays, Nette\Utils\Json: flags replaced with parameters

removed

  • Reflection: removed obsolete getReturnType(), getParameterType(), getPropertyType() (BC break)
utils - Released version 3.1.9

Published by dg over 1 year ago

  • Type: supports Disjunctive Normal Form Types
  • Validators: added isTypeDeclaration(), isBuiltinType(), isClassKeyword()
  • used PhpStorm Language attribute (#277)
  • Types::isSingle() -> isSimple()
utils - Released version 3.2.8

Published by dg about 2 years ago

  • support for PHP 8.2
  • tests: deprecated GD changed to PNG
  • Image::clone() uses PNG format because GD2 is disabled since libgd 2.3.3
  • Image::detectTypeFromFile & detectTypeFromString returns width & height
  • Image: added extensionToType()
  • private constants are PascalCase
  • ObjectHelpers: fixed parsing static @methods #278
utils - Released version 3.2.7

Published by dg over 2 years ago

  • SmartObject: supports property deprecation
  • Image: added support for AVIF
  • Image: distinguishes between fatal errors and warnings
  • Validators: isNumeric support string number '1.' (#276)
  • Json: accepts native JSON_* constants #275
  • Arrays::isList() uses array_is_list() is PHP 8.1

Deprecated properties are written as @property-deprecated, no standard here exists. PhpStorm and static analysis tools do not see them, which is the intention.

utils - Released version 3.2.6

Published by dg almost 3 years ago

  • FileSystem: messages use normalized paths (#250)
  • Strings::indexOf() fixed empty $haystack and negative $nth #271
  • Strings: improved things around flags
  • Callback::unwrap can return non-callable #270
  • used @return never
  • added Helpers::clamp()
  • Validators::isPhpIdentifier(): Value is always string. (#268)
  • Reflection::expandClassName() recognizes 'parent'
  • added Reflection::isClassKeyword(), Type::isClassKeyword()
utils - Released version 3.2.5

Published by dg about 3 years ago

  • support for PHP 8.1
  • added Type
  • Type, Reflection: supports intersection types
  • Reflection::getReturnType() & Type::fromReflection() return tentative type in PHP 8.1
  • Reflection::getUseStatements supports enums
  • Reflection: added 'never' built-in type
  • Reflection: getReturnTypes(), getParameterTypes(), getPropertyTypes() are deprecated
  • improved phpDoc, used generics
  • added ArrayList::from()
utils - Released version 3.1.6 (end of life)

Published by dg about 3 years ago

  • added Type
  • improved phpDoc, used generics
  • Strings::replace: default replacement is empty string #241
  • Reflection: getReturnTypes(), getParameterTypes(), getPropertyTypes() are deprecated
utils - Released version 3.2.3

Published by dg about 3 years ago

  • FileSystem: Add method makeWritable() (#244)
  • Paginator: add firstItemOnPage & lastItemOnPage #262 (#263)
  • ObjectHelpers: improved error messages, added scope
utils - Released version 3.2.2

Published by dg over 3 years ago

  • Arrays: added wrap() method (#180)
  • Arrays::insertAfter() & insertBefore() fixed when $key is null
  • DateTime::fromParts() is non-locale aware #248
  • compatibility: improved code hinting
utils - Released version 3.2.1

Published by dg almost 4 years ago

  • added Arrays::first(), last() & contains()
  • added Array::invoke() & invokeMethod()
  • Arrays: some methods accepts iterable
  • Strings::toAscii() fixed to correctly convert german umlauts (BC break) (#240)
  • Strings::replace: default replacement is empty string #241

For the details you can have a look at the diff.

utils - Released version 3.2.0

Published by dg almost 4 years ago

  • requires PHP 7.2
  • Added Nette\Utils\Floats class for comparing floats (#221)
  • Arrays: searchKey() silently renamed to getKeyOffset()
  • Callback::closure() triggers deprecation notice
  • Image: added detectTypeFromFile() and detectTypeFromString()
  • Reflection::toString() appends () after function/method name
  • Strings::toAscii - triggers E_USER_NOTICE when ext-intl is not present
  • renamed Nette\Localization\ITranslator -> Translator, added class alias
  • renamed Nette\Utils\IHtmlString -> Nette\HtmlStringable, added class alias
utils - Released version 3.1.4

Published by dg almost 4 years ago

  • Reflection: added getReturnTypes(), getParameterTypes() and getPropertyTypes()
  • Reflection::getReturnType(), getParameterType() and getPropertyType() throws exception on union types
  • Image::fromString() throws UnknownImageFileException when file type is unknown

For the details you can have a look at the diff.

utils - Released version 3.0.4

Published by dg almost 4 years ago

  • compatible with PHP 8.0
  • Image::fromString() throws UnknownImageFileException when file type is unknown
  • Image: better processing and checking dimensions in strings #217
  • DateTime::from(null) fixed #211

For the details you can have a look at the diff.

utils - Released version 2.5.5

Published by dg almost 4 years ago

  • compatible with PHP 8.0
  • Image: better processing and checking dimensions in strings #217
  • Html::getText() decodes '

For the details you can have a look at the diff.