Latest release: v0.3.1

Utils

Content

There are many classes in this package. Almost all are extending from nette/utils and adding more functionality.

DateTime && DateTimeFactory

This extesions register simple DateTime provider -> DateTimeFactory.

extensions:
    datetime: Contributte\Utils\DI\DateTimeFactoryExtension
1
2

You can use the default or override it by our own implementation:

services:
    datetime.factory: App\Model\MyDateTimeFactory
1
2

Another useful methods added to DateTime:

  • setCurrentTime()
  • setZeroTime() && resetTime()
  • setMidnight()
  • setToday()
  • getFirstDayOfWeek()
  • getLastDayOfWeek()
  • getFirstDayOfMonth()
  • getLastDayOfMonth()
  • getFirstDayOfYear()
  • getLastDayOfYear()

Fields

Collections of functions for normalizing input:

  • inn($s)
  • tin($s)
  • zip($s)
  • phone($s)

FileSystem

Collection of extra functions:

  • pathalize($path)
  • extension($file)
  • purge($dir)

Strings

Collection of extra functions:

  • replacePrefix($s, $search, $replacement = '')
  • replaceSuffix($s, $search, $replacement = '')
  • spaceless($s)
  • doublespaceless($s)
  • dashless($s)
  • slashless($s)

Urls

Collection of extra functions:

  • hasFragment($url)

Validators

Collection of extra functions:

  • isIco($s) - trader identification number (Czech only)
  • isRc($s)- personal identification number (Czech and Slovak only)