PHPackages                             newball/spacetools - 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. newball/spacetools

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

newball/spacetools
==================

Generating white spaces and line breaks / newlines for repetitive and frequent use.

1.1.2(5y ago)011MITPHPPHP &gt;=7.2

Since Jan 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/newball/SpaceTools)[ Packagist](https://packagist.org/packages/newball/spacetools)[ Docs](https://github.com/Newball/SpaceTools)[ RSS](/packages/newball-spacetools/feed)WikiDiscussions main Synced 5d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

SpaceTools
==========

[](#spacetools)

[![Latest Version on Packagist](https://camo.githubusercontent.com/520df91acf2ef8a8c39c04ac9724df218d87e4c05d8bbb73b4ec49e72488e2a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e657762616c6c2f7370616365746f6f6c737265612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/newball/spacetools)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/e837809b382f52560990bb03a96353d8abc5a567f91ffc67b40ef85a9e4446c8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6e657762616c6c2f5370616365546f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/newball/SpaceTools/code-structure)[![Quality Score](https://camo.githubusercontent.com/a46480250a093ad047a9588c2fa67c4c960eb4b0e8c3a1ffb8ce5940ba1091e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6e657762616c6c2f5370616365546f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/newball/SpaceTools)[![Total Downloads](https://camo.githubusercontent.com/e15bfadd439541eabd8a89b346a46e5305bf80bf66f9c5dd4280d600a1be9be6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e657762616c6c2f7370616365746f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/newball/spacetools)

This is a tool that's all about space. Specifically blank space and line breaks. The purpose of this tool is to provide an easier way to add spaces in applications by using generated variables, instead of having to continually type them in. So something like this:

```
    $name = $someRandomVariable . " " . "the rest of whatever text here";

    $message = "Etiam porta sem malesuada magna mollis euismod.";
    $message .= "\n";
    $message .= "Maecenas faucibus mollis interdum.";

```

Can become something like this:

```
    $name = $someRandomVariable . $spaceVariable . "the rest of whatever text here";

    $message = "Etiam porta sem malesuada magna mollis euismod.";
    $message .= $lineBreakVariable;
    $message .= "Maecenas faucibus mollis interdum.";

```

Structure
---------

[](#structure)

If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.

```
src/
    /Newline                   # -> Contains all of the newline classes
    - Newline.php              # -> newline generator
    /Space                     # -> Contains all of the black space classes
    - Space.php                # -> blank space generator
    composer.json              # -> Autoloading for 'apps'

```

Install
-------

[](#install)

Via Composer

```
$ composer require Newball/SpaceTools
```

Usage
-----

[](#usage)

For blank spaces, use the space class.

```
$space = new Newball\SpaceTools\Space();
$bs = $space->spaces;
echo 'Hey,' . $bs . 'Space!';
```

The space class has two parameters. $chars is a number and indicates the amount of spaces wanted, $kind accepts either 'space' or 'escaped'. Space will return a " ", while escaped will return "\\040". By default these parameters are set to '1' and 'space'.

```
$space = new Newball\SpaceTools\Space(5,'escaped');
$bs = $space->spaces;
echo 'Hey,' . $bs . 'Tons' . $bs . 'Of' . $bs . 'Space';
```

For line breaks / newlines, use the newline class.

```
$newline = new Newball\SpaceTools\Newline();
$nl = $newline->nl;
echo 'Hey,' . $nl . 'A New Line!';
```

The newline class has two parameters. $lines is a number and indicates the amount of newlines wanted, $kind accepts either 'linebreak', 'return' or 'both'. linebreak will return a "\\n", return will return a "\\r", both will return "\\r\\n". By default these parameters are set to '1' and 'linebreal'.

```
$newline = new Newball\SpaceTools\Newline(2,'both');
$nl = $newline->nl;
echo 'Hey,' . $nl . 'A Bunch' . $nl . 'Of' . $nl . 'Lines';
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Leo Newball](https://github.com/Newball)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~2 days

Total

4

Last Release

1928d ago

PHP version history (2 changes)1.0.0PHP ~5.5

1.1.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/72a941918d4cf4676087a4fcff044f0b961a27d25fed0283e9a8a932876beafe?d=identicon)[newball](/maintainers/newball)

---

Top Contributors

[![newball](https://avatars.githubusercontent.com/u/484994?v=4)](https://github.com/newball "newball (32 commits)")

---

Tags

white-spacespaceline breaksNewballSpaceToolsNewlines

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/newball-spacetools/health.svg)

```
[![Health](https://phpackages.com/badges/newball-spacetools/health.svg)](https://phpackages.com/packages/newball-spacetools)
```

###  Alternatives

[shel/neos-commandbar

A commandbar (CMD+K) for Neos CMS

1614.6k1](/packages/shel-neos-commandbar)

PHPackages © 2026

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