2017 © Pedro Peláez
 

library space-tools

A few useful functions for PHP ("A Swiss army knife for PHP developers")

image

spaceboy/space-tools

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  • Saturday, May 12, 2018
  • by spaceboy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

SpaceTools

Some functions for PHP/Nette, (*1)

Function list:

getSizeInBytes

Recomputes filesizes from "INI" type strings ("10KB", "20MiB" etc.) to bytes * @param string $sizeStr Given size in string like "10KB" or "20MiB" * @return integer Recalculated size in bytes, (*2)

getIniSize

Finds number from PHP.INI file ("10KB", "20MiB") and returns it in given format * @param string $item Given PHP.INI key * @param integer $formatDecimals Decimal numbers count * @param string $formatDecPoint Decimal separator * @param string $formatThousandsSeparator: Thousands separator * @return array - original => Original string - bytes => Original string in bytes - formated => Original string in bytes in given format, (*3)

getMaxFileSize

Finds maximum size of uploadable file (as given in PHP.INI) * @param integer $formatDecimals Decimal numbers count * @param string $formatDecPoint Decimal separator * @param string $formatThousandsSeparator: Thousands separator * @return array - original => Original string - bytes => Original string in bytes - formated => Original string in bytes in given format, (*4)

arrayRemap

Remaps array * @param array $source Source array * @param array $map "Map" for reindexing: array of items, where input index is key and output index value (original_index => new_index, original_index2 => new_index2 ... ) * @param boolean $preserveUnset When TRUE, method returns indexes undefined in source array (with $default value) * @param $mixed $default Value for unset items * @return array, (*5)

isPathAbsolute

Checks whether path (of filesystem) is absolute (c:\something | /something) * @param string $path * @return boolean * @throws \Exception (when no path or path is NULL), (*6)

toArray

Merges items of input array to unindexed array * @param array $args input array - can contain scalars and arrays (or arrays of arrays); other items (such objects, closures) are ignored * @return array, (*7)

arrayIsAssoc

Checks whether array is associative (with named indexes) * @param array $arr * @return boolean, (*8)

purgeDir

Clears dir incl. files and subdirectories * @param string $dir * @return void, (*9)

findMethodInPhp

Finds use of given method in PHP file * @param string $phpFile * @param string $methodName * @return array (line number => part of line where method [$methodName] is used) * @throws \InvalidArgumentException, (*10)

parseLineFromFile

Returns array of line(s) with specified numbers from given file * @param string $fileName * @param integer|array $line * @return array * @throws \InvalidArgumentException, (*11)

isFile

If given file does not exists OR is not a file, throws InvalidArgumentException exception * @param string $fileName * @return void * @throws \InvalidArgumentException, (*12)

The Versions

12/05 2018

dev-master

9999999-dev

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

php array nette directory path spaceboy space-tools file size

12/05 2018

1.2.1

1.2.1.0

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

php array directory path spaceboy space-tools file size

12/05 2018

1.2.0

1.2.0.0

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

php array directory path spaceboy space-tools file size

21/07 2017

1.1.2

1.1.2.0

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

php array directory path spaceboy space-tools file size

21/07 2017

1.0.2

1.0.2.0

A few useful functions for PHP ("A Swiss army knife for PHP developers")

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

php array directory path spaceboy space-tools file size

21/07 2017

1.1.1

1.1.1.0

Some functions for PHP/Nette

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

nette spaceboy space-tools

21/07 2017

1.1.0

1.1.0.0

Some functions for PHP/Nette

  Sources   Download

MIT

The Requires

  • php >= 5.3

 

by Avatar spaceboy

nette spaceboy space-tools

01/01 2017

1.0.x-dev

1.0.9999999.9999999-dev

Some functions for PHP/Nette

  Sources   Download

MIT

The Requires

 

by Avatar spaceboy

nette spaceboy space-tools

01/01 2017

1.0.3

1.0.3.0

Some functions for PHP/Nette

  Sources   Download

MIT

The Requires

 

by Avatar spaceboy

nette spaceboy space-tools

31/12 2016

1.0.0

1.0.0.0

Some functions for PHP/Nette

  Sources   Download

The Requires

 

31/12 2016

1.0.1-stable

1.0.1.0

Some functions for PHP/Nette

  Sources   Download

The Requires