PHPackages                             spaceboy/space-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. spaceboy/space-tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spaceboy/space-tools
====================

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

1.2.3(5y ago)1401MITPHPPHP &gt;= 5.3

Since Dec 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/spaceboy/SpaceTools)[ Packagist](https://packagist.org/packages/spaceboy/space-tools)[ RSS](/packages/spaceboy-space-tools/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (13)Used By (1)

SpaceTools
==========

[](#spacetools)

Some functions for PHP/Nette

Function list:
--------------

[](#function-list)

### getSizeInBytes

[](#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

### getIniSize

[](#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 =&gt; Original string
    - bytes =&gt; Original string in bytes
    - formated =&gt; Original string in bytes in given format

### getMaxFileSize

[](#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 =&gt; Original string
    - bytes =&gt; Original string in bytes
    - formated =&gt; Original string in bytes in given format

### arrayRemap

[](#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 =&gt; new\_index, original\_index2 =&gt; 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

### isPathAbsolute

[](#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)

### toArray

[](#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

### arrayIsAssoc

[](#arrayisassoc)

Checks whether array is associative (with named indexes)

- @param array $arr
- @return boolean

### purgeDir

[](#purgedir)

Clears dir incl. files and subdirectories

- @param string $dir
- @return void

### findMethodInPhp

[](#findmethodinphp)

Finds use of given method in PHP file

- @param string $phpFile
- @param string $methodName
- @return array (line number =&gt; part of line where method \[$methodName\] is used)
- @throws \\InvalidArgumentException

### parseLineFromFile

[](#parselinefromfile)

Returns array of line(s) with specified numbers from given file

- @param string $fileName
- @param integer|array $line
- @return array
- @throws \\InvalidArgumentException

### isFile

[](#isfile)

If given file does not exists OR is not a file, throws InvalidArgumentException exception

- @param string $fileName
- @return void
- @throws \\InvalidArgumentException

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~124 days

Recently: every ~291 days

Total

12

Last Release

2056d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09d6444dda5f70a00423d2d049409f3670a49c0c2d008add06820d45c4f680e6?d=identicon)[spaceboy](/maintainers/spaceboy)

---

Top Contributors

[![spaceboy](https://avatars.githubusercontent.com/u/419521?v=4)](https://github.com/spaceboy "spaceboy (17 commits)")

---

Tags

phparraypathdirectoryfile-sizespaceboyspace-tools

### Embed Badge

![Health badge](/badges/spaceboy-space-tools/health.svg)

```
[![Health](https://phpackages.com/badges/spaceboy-space-tools/health.svg)](https://phpackages.com/packages/spaceboy-space-tools)
```

###  Alternatives

[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
