PHPackages                             3f/tool-bag - 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. 3f/tool-bag

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

3f/tool-bag
===========

A bunch of idempotent static functions organised into categories to be reused in multiple projects.

1.1.4(8y ago)06.3k↓44.8%4Apache-2.0PHPPHP &gt;=5.6.0

Since Nov 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dedalozzo/tool-bag)[ Packagist](https://packagist.org/packages/3f/tool-bag)[ Docs](https://github.com/dedalozzo/tool-bag)[ RSS](/packages/3f-tool-bag/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (4)

[![Latest Stable Version](https://camo.githubusercontent.com/ffedb1ae0e9c1179e022dcf685c32e68c303fbcc19dc9d5a80f2b175f47601bf/68747470733a2f2f706f7365722e707567782e6f72672f33662f746f6f6c2d6261672f762f737461626c652e706e67)](https://packagist.org/packages/3f/tool-bag)[![Latest Unstable Version](https://camo.githubusercontent.com/5a57a176cc1f25a678c27a593302eba400c819e2c3f11c42ce0c0e2967e667b7/68747470733a2f2f706f7365722e707567782e6f72672f33662f746f6f6c2d6261672f762f756e737461626c652e706e67)](https://packagist.org/packages/3f/tool-bag)[![Build Status](https://camo.githubusercontent.com/6247317cfeb3df92ba99ca78b368cdfc8003b11503521c957ec9ecaf986a645f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646564616c6f7a7a6f2f746f6f6c2d6261672f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4f8557df62ecc4f39415ed0778bcd2ce7f9b778802ceec159d37f0072e58381c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646564616c6f7a7a6f2f746f6f6c2d6261672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/?branch=master)[![License](https://camo.githubusercontent.com/6f976221c726cc7a314ecde7b4dc9f6cbbc5f4dd116761d5dbf8ec2935320657/68747470733a2f2f706f7365722e707567782e6f72672f33662f746f6f6c2d6261672f6c6963656e73652e737667)](https://packagist.org/packages/3f/tool-bag)[![Total Downloads](https://camo.githubusercontent.com/3e9d98934e2a6c35fdc7f774d969d16313ac6f3c55752e8c09420856046f9cc8/68747470733a2f2f706f7365722e707567782e6f72672f33662f746f6f6c2d6261672f646f776e6c6f6164732e706e67)](https://packagist.org/packages/3f/tool-bag)

ToolBag
=======

[](#toolbag)

A bunch of idempotent static functions organised into categories to be reused in multiple projects.

Composer Installation
---------------------

[](#composer-installation)

To install ToolBag, you first need to install [Composer](http://getcomposer.org/), a Package Manager for PHP, following these few [steps](http://getcomposer.org/doc/00-intro.md#installation-nix):

```
curl -s https://getcomposer.org/installer | php
```

You can run this command to easily access composer from anywhere on your system:

```
sudo mv composer.phar /usr/local/bin/composer
```

ToolBag Installation
--------------------

[](#toolbag-installation)

Once you have installed Composer, it's easy install ToolBag.

1. Edit your `composer.json` file, adding ToolBag to the require section:

```
{
    "require": {
        "3f/tool-bag": "dev-master"
    },
}
```

2. Run the following command in your project root dir:

```
composer update
```

Usage
-----

[](#usage)

The tool bag provides four different helpers:

- `ArrayHelper` -&gt; common array methods
- `ClassHelper` -&gt; routines to handle classes
- `TextHelper` -&gt; routines to process strings
- `TimeHelper` -&gt; routines to handle and manipulate time

All the methods are static, so you don't need to create an class instance to use them.

```
if (ArrayHelper::isAssociative([1, 2, 3]))
  echo "It's an associative array.";
else
  echo "It's not associative array.";
```

Methods
-------

[](#methods)

#### ArrayHelper

[](#arrayhelper)

MethodDescription`isAssociative()`Checks if the array is associative.`toObject()`Converts the array to an object.`fromJson()`Converts the given JSON into an array.`slice()`Returns a portion of the array.`value()`Given a key, returns its related value.`key()`Given a key, returns it only if exists otherwise return `false`.`unversion()`Modifies the specified array, depriving each ID of its related version.`merge()`Merge the two given arrays. The returned array doesn't contain duplicate values.`multidimensionalUnique()`Like `array_unique()`, removes duplicate values, but works on multidimensional arrays.#### ClassHelper

[](#classhelper)

MethodDescription`getClass()`Given a class path, returns the class name even included its namespace.`getClassName()`Given a class within its namespace, it returns the class name pruned by its namespace.`getClassRoot()`Given a namespace, it returns the namespace itself pruned by its last part.#### TextHelper

[](#texthelper)

MethodDescription`convertCharset()`Converts a string from a charset to another one.`truncate()`Cuts a string to a given number of characters without breaking words.`capitalize()`Capitalizes the given string.`purge()`Removes the content of pre tags, than strip all tags.`stick()`Generates a single word, stripping every `-` from a compound word.`substrings()`Given a string, returns all the unique contained substrings.`slug()`Generates a slug from the provided string.`buildUrl()`Builds the post url, given its publishing or creation date and its slug.`replaceAllButFirst()`Replaces all the occurrences but first.`unversion()`Prunes the ID of its version number, if any.`formatNumber()`Formats the number replacing the thousand separator with the decimal point.`splitFullName()`Separates the given full name into first name and last name.`sanitize()`Removes unwanted MS Word smart characters from a string.#### TimeHelper

[](#timehelper)

MethodDescription`since()`Returns an associative array with the elapsed time, from the provided timestamp, in days, hours, minutes and seconds.`period()`Checks if the provided string represents a period of time and returns it if exists otherwise returns `false`.`when()`Returns a measure of the time passed since the provided timestamp. In case is passed more than a day, returns a human readable date.`aWhileBack`Given a constant representing a period, returns a formatted string.`minMaxInPeriod()`Given a constant representing a period, returns a range of timestamps (minimum and maximum) for that period.`dateLimits()`Given a period of time (an year, a month or a day), calculates the date limits for that period.Documentation
-------------

[](#documentation)

The documentation can be generated using [Doxygen](http://doxygen.org). A `Doxyfile` is provided for your convenience.

Authors
-------

[](#authors)

Filippo F. Fadda -  -

Copyright
---------

[](#copyright)

Copyright (c) 2016-2017, Filippo Fadda All rights reserved.

License
-------

[](#license)

ToolBag is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

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

Total

6

Last Release

3015d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/311248?v=4)[Filippo Fadda](/maintainers/dedalozzo)[@dedalozzo](https://github.com/dedalozzo)

---

Top Contributors

[![dedalozzo](https://avatars.githubusercontent.com/u/311248?v=4)](https://github.com/dedalozzo "dedalozzo (26 commits)")

---

Tags

libraryphptoolutilitiesutilshelpertoolfunctionutiltool bag

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/3f-tool-bag/health.svg)

```
[![Health](https://phpackages.com/badges/3f-tool-bag/health.svg)](https://phpackages.com/packages/3f-tool-bag)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

278673.4k4](/packages/laravelista-ekko)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[kevinlebrun/slug.php

Slug helpers

4451.4k1](/packages/kevinlebrun-slugphp)[kevinlebrun/password.php

Helpers for password generation and validation

17142.3k1](/packages/kevinlebrun-passwordphp)[clausnz/php-helpers

A Collection of useful php helper functions.

388.7k](/packages/clausnz-php-helpers)

PHPackages © 2026

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