PHPackages                             sefirosweb/laravel-general-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. sefirosweb/laravel-general-helper

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

sefirosweb/laravel-general-helper
=================================

A bundle of helpers for develop, contains method for generate excels , csv, array optimizations and more

1.5.5(1y ago)11571MITPHP

Since Feb 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sefirosweb/laravel-general-helper)[ Packagist](https://packagist.org/packages/sefirosweb/laravel-general-helper)[ RSS](/packages/sefirosweb-laravel-general-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (16)Used By (0)

Laravel General Helper
======================

[](#laravel-general-helper)

A bundle of helpers for develop, contains method for generate excels , csv, array optimizations and more

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

[](#installation)

```
composer require sefirosweb/laravel-general-helper

```

For save file need a run migration for manage who has created the file, only have access own creator,

```
php artisan migrate

```

Optional configuration
----------------------

[](#optional-configuration)

You can change the middleware and prefix path for get the files, need publish config

```
php artisan vendor:publish --provider="Sefirosweb\LaravelGeneralHelper\LaravelGeneralHelperServiceProvider"

```

**Helpers**

- [pathTemp](#pathTemp)
- [array\_group\_by](#array_group_by)
- [array\_group\_by\_multidimensional](#array_group_by_multidimensional)
- [objectToArray](#objectToArray)
- [generateMarks](#generateMarks)
- [createMarks](#createMarks)
- [char\_at](#char_at)
- [mergeArrays](#mergeArrays)
- [mergeArraysOnSubArray](#mergeArraysOnSubArray)
- [query](#query)
- [excelToArray](#excelToArray)
- [saveCsvInServerAndDownload](#saveCsvInServerAndDownload)
- [saveCsvInServer](#saveCsvInServer)
- [validateArray](#validateArray)
- [saveExcelInServer](#saveExcelInServer)
- [saveExcelInServerAndDownload](#saveExcelInServerAndDownload)
- [br2nl](#br2nl)
- [eliminar\_tildes](#eliminar_tildes)

**Helper class**

- [RequestCache](#RequestCache)
- [RedisHelper](#RedisHelper)

Helpers
-------

[](#helpers)

### pathTemp

[](#pathtemp)

Obtain and create the path "tmp" if it does not exist, it is created automatically, in this path the temporary files used for this package are stored

```
$path = pathTemp();
// $path = /var/www/html/storage/tmp
```

### array\_group\_by

[](#array_group_by)

Group an array by "identifier", if the third optional value is true, only get the first element of group

```
array_group_by(array $array, string $key, bool $onlyFirstValue = false)

$array = [
    [
        'name' => 'pablo',
        'date' => '02'
    ],
    [
        'name' => 'pablo',
        'date' => '03'
    ],
    [
        'name' => 'selena',
        'date' => 'XX'
    ]
];

$arrayAgrouped = array_group_by($array, 'name');
// Returns:
[
    'pablo' => [
        [
            'name' => 'pablo',
            'date' => '02',
        ],
        [
            'name' => 'pablo',
            'date' => '03',
        ]
    ],
    'selena' => [
        [
            'name' => 'selena',
            'date' => 'XX'
        ]
    ]
]

$arrayAgrouped = array_group_by($array, 'name', true);
[
    'pablo' =>
        [
            'name' => 'pablo',
            'date' => '02',
        ],
    'selena' =>
        [
            'name' => 'selena',
            'date' => 'XX'
        ]
]
```

### array\_group\_by\_multidimensional

[](#array_group_by_multidimensional)

Same as function "array\_group\_by" but in this case you can sub-group the array in multiple conditions

```
array_group_by_multidimensional(array $array, array $union_by, bool $onlyFirstValue = false)

$array = [
    [
        'name' => 'pablo',
        'date' => '02'
    ],
    [
        'name' => 'pablo',
        'date' => '03'
    ],
    [
        'name' => 'selena',
        'date' => 'XX'
    ]
];

$arrayAgrouped = array_group_by_multidimensional($array, ['name','date']);
// Returns:
[
    'pablo' => [
        '02' => [ //  'pablo',
                'date' => '02',
            ],
        ],
        '03' => [
            [
                'name' => 'pablo',
                'date' => '03',
            ]
        ]
    ],
    'selena' => [
        'XX' => [
            [
                'name' => 'selena',
                'date' => 'XX'
            ]
        ]
    ]
]

$arrayAgrouped = array_group_by_multidimensional($array, ['name','date'], true);
// Returns:
[
    'pablo' => [
        '02' =>
            [ // Only returns the first item in level of 02
                'name' => 'pablo',
                'date' => '02',
            ],

        '03' =>
            [
                'name' => 'pablo',
                'date' => '03',
            ]
    ],
    'selena' => [
        'XX' =>
            [
                'name' => 'selena',
                'date' => 'XX'
            ]
    ]
]
```

### objectToArray

[](#objecttoarray)

Convert stdClass object to full array values, it is required for use the array group functions

```
$var = new stdClass();
$var->field = 5;

$array = objectToArray(object $var);
// $array = [
//     'field' => 5;
// ]
```

### generateMarks

[](#generatemarks)

`TODO`

### createMarks

[](#createmarks)

`TODO`

### char\_at

[](#char_at)

`TODO`

### validateArray

[](#validatearray)

`TODO`

### mergeArrays

[](#mergearrays)

`TODO`

### mergeArraysOnSubArray

[](#mergearraysonsubarray)

`TODO`

### query

[](#query)

`TODO`

### excelToArray

[](#exceltoarray)

`TODO`

### saveCsvInServerAndDownload

[](#savecsvinserveranddownload)

`TODO`

### saveCsvInServer

[](#savecsvinserver)

Function for save an structured array data into csv, and returns a object "FileSaved"

```
saveCsvInServer(array $arrayData, string $fileName, string $delimiter = ';', string $enclosure = '"', bool $latingMode = false, bool $headers = true, bool $utf8_decode = false, bool $enclosureAll = false)

$array = [
    [
        'name' => 'pablo',
        'date' => '02'
    ],
    [
        'name' => 'pablo',
        'date' => '03'
    ],
    [
        'name' => 'selena',
        'date' => 'XX'
    ]
];

$file = saveCsvInServer($array, 'filename');
// Returns a SavedFile model object
$file->id
$file->path
...
```

### saveExcelInServer

[](#saveexcelinserver)

Function for save an structured array data into excel (for huge data is recommended CSV, save data in excel have low performance)

```
$array = [
    [
        'name' => 'pablo',
        'date' => '02'
    ],
    [
        'name' => 'pablo',
        'date' => '03'
    ],
    [
        'name' => 'selena',
        'date' => 'XX'
    ]
];

$file = saveCsvInServer($array, 'filename');
// Returns a SavedFile model object
$file->id
$file->path
...
```

### saveExcelInServerAndDownload

[](#saveexcelinserveranddownload)

`TODO`

### br2nl

[](#br2nl)

Replace &lt;br&gt; into new lines "\\n"

```
$resultString = br2nl('helloworld');
// $resultString = 'hello\nworld'
```

### eliminar\_tildes

[](#eliminar_tildes)

Function for remove the latin characters "á', 'à', 'ä', 'â', 'ª', 'Á', 'À', 'Â', 'Ä'" into "a / A"

```
$resultString = eliminar_tildes('Camión');
// $resultString = 'Camion'
```

Helper class
------------

[](#helper-class)

### RequestCache

[](#requestcache)

Store in memory for the **current request** some data, this can be stored and retrieved from any code of your app, usefull to avoid execute multiple queries and don't want to store in some cache system

```
// Store data
CacheRequest::set('anyKey', $anyData);

// Retrieve data
$retrieveData = CacheRequest::get('anyKey');

// Hot cache data from function, if key not exists then execute the function to generate them
$retrieveData = CacheRequest::remember('anyKey', function () {
    // .. do something
    return 'return any data';
});

// Delete cache
CacheRequest::delete('anyKey');
```

### RedisHelper

[](#redishelper)

Similar to RequestCache, but ther store data in to Redis cache system:

```
// Store data
RedisHelper::set('anyKey', $anyData, $timeout);

// Retrieve datacall($function, $key = '', $prod = false, $EX = 86400)
$retrieveData = RedisHelper::get('anyKey');

// Hot cache data from function, if key not exists then execute the function to generate them, for default is not executed in production
$retrieveData = RedisHelper::call(function(){
    // .. do something
    return 'return any data';
}, 'anyKey', $executeInProduction, $timeout);

// Delete cache
RedisHelper::delete('anyKey')
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Recently: every ~169 days

Total

15

Last Release

701d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e00c36bae7e59a7375c9bc0e0280ef4004afa4ca968ea6cd62f7d880df2dbd66?d=identicon)[sefirosweb](/maintainers/sefirosweb)

---

Top Contributors

[![sefirosweb](https://avatars.githubusercontent.com/u/20754836?v=4)](https://github.com/sefirosweb "sefirosweb (39 commits)")

### Embed Badge

![Health badge](/badges/sefirosweb-laravel-general-helper/health.svg)

```
[![Health](https://phpackages.com/badges/sefirosweb-laravel-general-helper/health.svg)](https://phpackages.com/packages/sefirosweb-laravel-general-helper)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[in2code/powermail

Powermail is a well-known, editor-friendly, powerful and easy to use mailform extension for TYPO3 with a lots of features

982.5M38](/packages/in2code-powermail)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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