PHPackages                             mantas-done/laravel-sparkles - 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. mantas-done/laravel-sparkles

Abandoned → [mantas-done/laravel-sparkles](/?search=mantas-done%2Flaravel-sparkles)Library[Utility &amp; Helpers](/categories/utility)

mantas-done/laravel-sparkles
============================

Helpers for Laravel

v1.0.1(8y ago)319PHP

Since Nov 25Pushed 8y ago3 watchersCompare

[ Source](https://github.com/mantas-done/laravel-sparkles)[ Packagist](https://packagist.org/packages/mantas-done/laravel-sparkles)[ RSS](/packages/mantas-done-laravel-sparkles/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Laravel Sparkles
----------------

[](#laravel-sparkles)

Laravel Sparkles is a collection of helpers that are often used in my Laravel project.

Instalation
-----------

[](#instalation)

```
composer require mantas-done/laravel-sparkles 1.*

```

Usage
-----

[](#usage)

Get currently logged in user (the same as Auth::user())

```
user();
```

Current user IP address

```
ip();
```

#### delete()

[](#delete)

Delete all models in collection

```
delete($user->comments);

// equals to this
foreach ($user->comments as $comment) {
    $comment->delete();
}
```

Delete one model

```
delete($user->profilePicture);

// equals to
if ($user->profilePicture) {
    $user->profilePicture->delete();
}
```

#### forceDelete()

[](#forcedelete)

The same as delete(), but force deletes records (for soft deletes).

```
forceDelete($user->comments);

// equals to this
foreach ($user->comments as $comment) {
    $comment->forceDelete();
}
```

#### bustCache()

[](#bustcache)

Bust cache of files: CSS, images...
It adds md5 hash of a file.

```
echo bustCache('/css/app.css'); // /css/app.css?v=0c39e0bb074f164bc2e7e3e5854927c5
```

#### twoDigits()

[](#twodigits)

Display currency with two digits.

```
twoDigits(1.2);      // 1.20
twoDigits(1.234);    // 1.23
twoDigits(1, '$');   // $1.00
twoDigits(-1, '$');  // -$1.00
```

#### Cookies

[](#cookies)

Simplifies working with Laravel cookies. You can call those functions from anywhere in your code unlike Laravel cookie implementation.

```
cookieSet('name', 'value', 60);
cookieGet('name');
cookieForget('name');
```

#### paginate()

[](#paginate)

Paginates collection or array and returns default Laravel paginator.

```
$users_array = [[
    'email' => 'abc@abc.com',
    'name' => 'Abc',
], [
    'email' => 'bcd@bcd.com',
    'name' => 'Bcd',
]];

$users = paginate($users_array);

return view('users.index', compact('users');
```

#### validate()

[](#validate)

Controller request data validation

```
// use
UserController extends Controller
{
    public function store() {
        validate([
            'email' => 'required|email',
        ]);

        // save user
    }
}

// instead of
UserController extends Controller
{
    public function store(Request $request) {
        $request->validate([
            'email' => 'required|email',
        ]);

        // save user
    }
}
```

Function data validation

```
class Comment
{
    public static function saveComment($email, $comment) {
        validate([
            'email' => 'required|email',
            'comment' => 'required|string|between:1,256',
        ], compact('email', 'comment'));

        // save comment
    }
}
```

#### deleteAllDirectoryFilesExceptGitignore()

[](#deletealldirectoryfilesexceptgitignore)

When folder is created in /storag/app folder, usually it has .gitignore file added to it.
When migrating and seeding database in development, it is beneficial to delete all files from some folders.

```
deleteAllDirectoryFilesExceptGitignore('/storage/app/uploads');
```

#### faker()

[](#faker)

Get instance of a faker

```
echo faker()->email;
```

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

[](#contributing)

I decided to share my helpers when I saw that similar concepts got implemented in Laravel, like **artisan fresh** and **now()**.
I believe that other developers have their own gems hidden in their code. If you would like to share one of them, please create a pull request to **master** branch.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

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

Total

2

Last Release

3091d ago

### Community

Maintainers

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

---

Top Contributors

[![mantas-done](https://avatars.githubusercontent.com/u/17127206?v=4)](https://github.com/mantas-done "mantas-done (4 commits)")

### Embed Badge

![Health badge](/badges/mantas-done-laravel-sparkles/health.svg)

```
[![Health](https://phpackages.com/badges/mantas-done-laravel-sparkles/health.svg)](https://phpackages.com/packages/mantas-done-laravel-sparkles)
```

###  Alternatives

[lupecode/php-trader-native

An native version of the PHP Trader extension.

106118.3k1](/packages/lupecode-php-trader-native)[beechit/news-ttnewsimport

Importer of ext:tt\_news items to ext:news

2012.6k](/packages/beechit-news-ttnewsimport)

PHPackages © 2026

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