{"id":19826865,"url":"https://github.com/dedalozzo/tool-bag","last_synced_at":"2026-06-13T05:33:05.387Z","repository":{"id":56938271,"uuid":"106752630","full_name":"dedalozzo/tool-bag","owner":"dedalozzo","description":"A bunch of idempotent static functions organised into categories to be reused in multiple projects.","archived":false,"fork":false,"pushed_at":"2018-02-15T15:19:35.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-24T22:05:38.446Z","etag":null,"topics":["library","php","tool","utilities","utils"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dedalozzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-12T22:41:45.000Z","updated_at":"2017-10-13T00:25:26.000Z","dependencies_parsed_at":"2022-08-21T06:50:20.584Z","dependency_job_id":null,"html_url":"https://github.com/dedalozzo/tool-bag","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/dedalozzo/tool-bag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedalozzo%2Ftool-bag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedalozzo%2Ftool-bag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedalozzo%2Ftool-bag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedalozzo%2Ftool-bag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dedalozzo","download_url":"https://codeload.github.com/dedalozzo/tool-bag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dedalozzo%2Ftool-bag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34273788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","php","tool","utilities","utils"],"created_at":"2024-11-12T11:11:51.776Z","updated_at":"2026-06-13T05:33:05.371Z","avatar_url":"https://github.com/dedalozzo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/3f/tool-bag/v/stable.png)](https://packagist.org/packages/3f/tool-bag)\n[![Latest Unstable Version](https://poser.pugx.org/3f/tool-bag/v/unstable.png)](https://packagist.org/packages/3f/tool-bag)\n[![Build Status](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/badges/build.png?b=master)](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/build-status/master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dedalozzo/tool-bag/?branch=master)\n[![License](https://poser.pugx.org/3f/tool-bag/license.svg)](https://packagist.org/packages/3f/tool-bag)\n[![Total Downloads](https://poser.pugx.org/3f/tool-bag/downloads.png)](https://packagist.org/packages/3f/tool-bag)\n\n\nToolBag\n========\nA bunch of idempotent static functions organised into categories to be reused in multiple projects.\n\n\nComposer Installation\n---------------------\n\nTo install ToolBag, you first need to install [Composer](http://getcomposer.org/), a Package Manager for\nPHP, following these few [steps](http://getcomposer.org/doc/00-intro.md#installation-nix):\n\n```sh\ncurl -s https://getcomposer.org/installer | php\n```\n\nYou can run this command to easily access composer from anywhere on your system:\n\n```sh\nsudo mv composer.phar /usr/local/bin/composer\n```\n\n\nToolBag Installation\n--------------------\nOnce you have installed Composer, it's easy install ToolBag.\n\n1. Edit your `composer.json` file, adding ToolBag to the require section:\n```sh\n{\n    \"require\": {\n        \"3f/tool-bag\": \"dev-master\"\n    },\n}\n```\n2. Run the following command in your project root dir:\n```sh\ncomposer update\n```\n\nUsage\n-----\nThe tool bag provides four different helpers:\n \n- `ArrayHelper` -\u003e common array methods\n- `ClassHelper` -\u003e routines to handle classes\n- `TextHelper` -\u003e routines to process strings\n- `TimeHelper` -\u003e routines to handle and manipulate time\n\n\nAll the methods are static, so you don't need to create an class instance to use them.\n\n```php\nif (ArrayHelper::isAssociative([1, 2, 3]))\n  echo \"It's an associative array.\";\nelse\n  echo \"It's not associative array.\";\n```\n\nMethods\n-------\n\n#### ArrayHelper\n\n| Method | Description |\n| --- | --- |\n| `isAssociative()` | Checks if the array is associative. |\n| `toObject()` | Converts the array to an object. |\n| `fromJson()` | Converts the given JSON into an array. |\n| `slice()` | Returns a portion of the array. |\n| `value()` | Given a key, returns its related value. |\n| `key()` | Given a key, returns it only if exists otherwise return `false`. |\n| `unversion()` | Modifies the specified array, depriving each ID of its related version. |\n| `merge()` | Merge the two given arrays. The returned array doesn't contain duplicate values. |\n| `multidimensionalUnique()` | Like `array_unique()`, removes duplicate values, but works on multidimensional arrays. |\n\n#### ClassHelper\n\n| Method | Description |\n| --- | --- |\n| `getClass()` | Given a class path, returns the class name even included its namespace. |\n| `getClassName()` | Given a class within its namespace, it returns the class name pruned by its namespace. |\n| `getClassRoot()` | Given a namespace, it returns the namespace itself pruned by its last part. |\n\n#### TextHelper\n\n| Method | Description |\n| --- | --- |\n| `convertCharset()` | Converts a string from a charset to another one. |\n| `truncate()` | Cuts a string to a given number of characters without breaking words. |\n| `capitalize()` | Capitalizes the given string. |\n| `purge()` | Removes the content of pre tags, than strip all tags. |\n| `stick()` | Generates a single word, stripping every `-` from a compound word. |\n| `substrings()` | Given a string, returns all the unique contained substrings. |\n| `slug()` | Generates a slug from the provided string. |\n| `buildUrl()` | Builds the post url, given its publishing or creation date and its slug. |\n| `replaceAllButFirst()` | Replaces all the occurrences but first. |\n| `unversion()` | Prunes the ID of its version number, if any. |\n| `formatNumber()` | Formats the number replacing the thousand separator with the decimal point. |\n| `splitFullName()` | Separates the given full name into first name and last name. |\n| `sanitize()` | Removes unwanted MS Word smart characters from a string. |\n\n#### TimeHelper\n\n| Method | Description |\n| --- | --- |\n| `since()` | Returns an associative array with the elapsed time, from the provided timestamp, in days, hours, minutes and seconds. |\n| `period()` | Checks if the provided string represents a period of time and returns it if exists otherwise returns `false`. |\n| `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. |\n| `aWhileBack` | Given a constant representing a period, returns a formatted string. |\n| `minMaxInPeriod()` | Given a constant representing a period, returns a range of timestamps (minimum and maximum) for that period. |\n| `dateLimits()` | Given a period of time (an year, a month or a day), calculates the date limits for that period. |\n\n\nDocumentation\n-------------\nThe documentation can be generated using [Doxygen](http://doxygen.org). A `Doxyfile` is provided for your convenience.\n\n\nAuthors\n-------\nFilippo F. Fadda - \u003cfilippo.fadda@programmazione.it\u003e - \u003chttp://www.linkedin.com/in/filippofadda\u003e\n\n\nCopyright\n---------\nCopyright (c) 2016-2017, Filippo Fadda\nAll rights reserved.\n\n\nLicense\n-------\nToolBag is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedalozzo%2Ftool-bag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdedalozzo%2Ftool-bag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdedalozzo%2Ftool-bag/lists"}