PHPackages                             jemer/string-helper - 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. jemer/string-helper

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

jemer/string-helper
===================

String and path utility classes

0.1.1(11mo ago)01MITPHP

Since May 26Pushed 5mo agoCompare

[ Source](https://github.com/J-Emer/String-Helper)[ Packagist](https://packagist.org/packages/jemer/string-helper)[ RSS](/packages/jemer-string-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

String Helper
=============

[](#string-helper)

A lightweight PHP library providing useful string, path, and table helper functions.

Features
--------

[](#features)

- String manipulation utilities
- Path handling helpers
- Table utility
- Easy to integrate and extend
- Fully tested with PHPUnit

Installation
------------

[](#installation)

Install via Composer:

```
composer require jemer/string-helper
```

PathHelper utility
------------------

[](#pathhelper-utility)

```
use Jemer\StringHelper\PathHelper;

// Get the filename from a path
echo PathHelper::fileName("/var/www/index.php"); // index.php

// Get the filename without extension
echo PathHelper::fileNameWithoutExtension("/var/www/index.php"); // index

// Get the extension from a file path
echo PathHelper::extension("/var/www/index.php"); // php

// Get all files from a directory (non-recursive)
print_r(PathHelper::getFiles("/path/to/directory"));

// Get all subdirectories from a directory
print_r(PathHelper::getDirectories("/path/to/directory"));

// Generate a path by joining parts
echo PathHelper::generatePath(["var", "www", "html"]); // var/www/html (or platform-specific separators)

// Get the containing directory for a file
echo PathHelper::containingDirectory("/var/www/index.php"); // /var/www
```

String Builder utility
----------------------

[](#string-builder-utility)

```
use Jemer\StringHelper\StringBuilder;

// Create a new StringBuilder instance
$stringBuilder = new StringBuilder();

// Add a simple string
$stringBuilder->Add("Hello, world!");

// Add an indented line (2 tabs)
$stringBuilder->Add_Indented("This is indented text.", 2);

// Add a comment line
$stringBuilder->AddComment("This is a comment");

// Add a horizontal dashed line of width 10
$stringBuilder->AddHorizontalLine(10);

// Add text surrounded by new lines
$stringBuilder->AddNewLineText("This text has blank lines before and after");

// Add just a new line
$stringBuilder->AddNewLine();

// Convert the built lines to a single string and output
echo $stringBuilder->ToString();

/*
Output example:

Hello, world!
        This is indented text.

//This is a comment

----------

This text has blank lines before and after

*/

// Clear the builder content to start fresh
$stringBuilder->Clear();
```

Table utility
-------------

[](#table-utility)

```
use Jemer\StringHelper\Table;

$table = new Table();
$table->setHeaders(['ID', 'Name', 'Email']);
$table->addRow(['1', 'John Doe', 'john@example.com']);
$table->addRow(['2', 'Jane Smith', 'jane@example.com']);

echo $table->render();

//outputs:
+----+------------+----------------------+
| ID |    Name    |        Email         |
+----+------------+----------------------+
| 1  |  John Doe  |   john@example.com   |
| 2  | Jane Smith |   jane@example.com   |
+----+------------+----------------------+
```

Running Tests
-------------

[](#running-tests)

```
vendor/bin/phpunit
```

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

[](#contributing)

Contributions are welcome! Please fork the repo and submit a pull request.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance63

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

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

Total

2

Last Release

357d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61d4bd4e6dee5b06ab7b7d0832d472ebeb41f07c86f4c2da54b45aed93e20fec?d=identicon)[J-Emer](/maintainers/J-Emer)

---

Top Contributors

[![J-Emer](https://avatars.githubusercontent.com/u/90985256?v=4)](https://github.com/J-Emer "J-Emer (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jemer-string-helper/health.svg)

```
[![Health](https://phpackages.com/badges/jemer-string-helper/health.svg)](https://phpackages.com/packages/jemer-string-helper)
```

PHPackages © 2026

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