PHPackages                             daikazu/misc-helpers - 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. daikazu/misc-helpers

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

daikazu/misc-helpers
====================

Misc PHP and Laravel helper functions and Classes

v1.3.0(3mo ago)01.5k↓72.2%MITPHPPHP ^8.3CI passing

Since Oct 31Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/daikazu/misc-helpers)[ Packagist](https://packagist.org/packages/daikazu/misc-helpers)[ Docs](https://github.com/daikazu/misc-helpers)[ GitHub Sponsors](https://github.com/Daikazu)[ RSS](/packages/daikazu-misc-helpers/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)Dependencies (26)Versions (7)Used By (0)

Misc PHP and Laravel helper functions and Classes
=================================================

[](#misc-php-and-laravel-helper-functions-and-classes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec7b19f0d648233469b4c8aad3fc8e22919808908a77529900b22c5e32634c95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461696b617a752f6d6973632d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daikazu/misc-helpers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c1a07121ed803b053884e56937a60eee2e3a69f78f25687ba39c0ab9a4eb62a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461696b617a752f6d6973632d68656c706572732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/daikazu/misc-helpers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/10fa95da5bb532d5bbdba5c2a800ca376499990ca56b1f9fbc10202ad92f0824/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461696b617a752f6d6973632d68656c706572732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/daikazu/misc-helpers/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5332a3d93608fffe37e807b0678cd7e420828481465ece8f0e01219a17f21aa7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461696b617a752f6d6973632d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daikazu/misc-helpers)

This package provides a collection of helper functions and classes for PHP and Laravel.

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

[](#installation)

You can install the package via composer:

```
composer require daikazu/misc-helpers
```

Usage
-----

[](#usage)

### Helper Functions

[](#helper-functions)

#### format\_business\_hours

[](#format_business_hours)

Formats business hours into a human-readable string.

```
$hours = [
    'monday' => ['open' => '09:00', 'close' => '17:00'],
    'tuesday' => ['open' => '09:00', 'close' => '17:00'],
    'wednesday' => ['open' => '09:00', 'close' => '17:00']
];

$formatted = format_business_hours($hours, 'America/New_York');
echo $formatted; // Outputs: Monday - Wednesday 9am-5pm EDT
```

#### calculate\_read\_time

[](#calculate_read_time)

Calculates the estimated read time for a given HTML content.

```
$content = 'This is a very short text.';
$readTime = calculate_read_time($content);
echo $readTime; // Outputs: 1
```

#### is\_blade\_section\_empty

[](#is_blade_section_empty)

Checks if a Blade section is empty.

```
@section('test')
    Section is empty
@endsection

```

```
$isEmpty = is_blade_section_empty('test');
var_dump($isEmpty); // Outputs: bool(false)
```

#### generate\_initials

[](#generate_initials)

Generates initials from a given name.

```
$name = 'John Doe';
$initials = generate_initials($name);
echo $initials; // Outputs: JD
```

#### clean\_string

[](#clean_string)

Cleans a string by removing extra whitespace and optionally converting it to lowercase.

```
$string = '   Hello    World   ';
$cleaned = clean_string($string);
echo $cleaned; // Outputs: Hello World
```

Artisan Commands
----------------

[](#artisan-commands)

PruneLogFilesCommand
--------------------

[](#prunelogfilescommand)

The `PruneLogFilesCommand` is a custom Artisan command used to prune old log files from the storage directory.

### Usage

[](#usage-1)

To run the command, use the following Artisan command:

```
php artisan log:prune
```

### Options

[](#options)

- `--days[=DAYS]`: The number of days to retain log files. Files older than this will be deleted. Default is 30 days.

### Example

[](#example)

To prune log files older than 15 days, run:

```
php artisan log:prune --days=15
```

Utility Classes
---------------

[](#utility-classes)

### PhpArrayFormatter

[](#phparrayformatter)

The PhpArrayFormatter class provides functionality to format PHP arrays into a readable string representation.

\####Usage To use the PhpArrayFormatter, you can create an instance of the class and call the format method with the array you want to format.

```
use App\Utilities\PhpArrayFormatter;

$array = [
    'name' => 'John Doe',
    'email' => 'john.doe@example.com',
    'roles' => ['admin', 'user']
];

$formatter = new PhpArrayFormatter();
$formattedArray = $formatter->format($array);

echo $formattedArray;
// Outputs:
// [
//     'name' => 'John Doe',
//     'email' => 'john.doe@example.com',
//     'roles' => [
//         'admin',
//         'user'
//     ]
// ]
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mike Wall](https://github.com/daikazu)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance80

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Recently: every ~125 days

Total

6

Last Release

107d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.2.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4039367?v=4)[Mike Wall](/maintainers/daikazu)[@daikazu](https://github.com/daikazu)

---

Top Contributors

[![daikazu](https://avatars.githubusercontent.com/u/4039367?v=4)](https://github.com/daikazu "daikazu (21 commits)")

---

Tags

laraveldaikazumisc-helpers

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/daikazu-misc-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/daikazu-misc-helpers/health.svg)](https://phpackages.com/packages/daikazu-misc-helpers)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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