PHPackages                             ashallendesign/laravel-command-spinner - 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. [CLI &amp; Console](/categories/cli)
4. /
5. ashallendesign/laravel-command-spinner

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

ashallendesign/laravel-command-spinner
======================================

A package for adding loading spinners to Laravel Artisan commands.

v0.1.0(5y ago)92792[1 PRs](https://github.com/ash-jc-allen/laravel-command-spinner/pulls)MITPHPPHP ^8.0

Since Apr 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ash-jc-allen/laravel-command-spinner)[ Packagist](https://packagist.org/packages/ashallendesign/laravel-command-spinner)[ Docs](https://github.com/ash-jc-allen/laravel-command-spinner)[ RSS](/packages/ashallendesign-laravel-command-spinner/feed)WikiDiscussions master Synced 1w ago

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

[![Laravel Command Spinner](/art/logo.png)](/art/logo.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cb53737b545419091ae3b7fe55c3bec70e742054d08166a47d0e14258704d6c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617368616c6c656e64657369676e2f6c61726176656c2d636f6d6d616e642d7370696e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashallendesign/laravel-command-spinner)[![Total Downloads](https://camo.githubusercontent.com/7cc5103dba03711ccbcc925d3c3ca88b0f091ef693356eddd28134ad9a9a4b01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617368616c6c656e64657369676e2f6c61726176656c2d636f6d6d616e642d7370696e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashallendesign/laravel-command-spinner)[![PHP from Packagist](https://camo.githubusercontent.com/736bcb0b07c1df6c1c062999b6921a1ca493f0b293477b0773cacad44f74ff93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f617368616c6c656e64657369676e2f6c61726176656c2d636f6d6d616e642d7370696e6e65723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashallendesign/laravel-command-spinner)[![GitHub license](https://camo.githubusercontent.com/a5b619324c68add000c2845f17978158650a04bc41970ce0fe8035605069f2c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6173682d6a632d616c6c656e2f6c61726176656c2d636f6d6d616e642d7370696e6e65723f7374796c653d666c61742d737175617265)](https://github.com/ash-jc-allen/laravel-command-spinner/blob/master/LICENSE)

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Installation](#installation)
    - [Requirements](#requirements)
    - [Install the Package](#install-the-package)
- [Usage](#usage)
    - [Adding Loading Spinners to Commands](#adding-loading-spinners-to-commands)
    - [Adding Text to the Spinner](#adding-text-to-the-spinner)
    - [Customising the Spinner Type](#customising-the-spinner-type)
- [Examples](#examples)
- [Gotchas](#gotchas)
- [Security](#security)
- [Contribution](#contribution)
- [License](#license)

Overview
--------

[](#overview)

A Laravel package that allows you to add 47 different styles of loading spinners to your Artisan commands.

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

[](#installation)

### Requirements

[](#requirements)

The package has been developed and tested to work with the following minimum requirements:

- PHP 8
- Laravel 8

### Install the Package

[](#install-the-package)

You can install the package via Composer:

```
composer require ashallendesign/laravel-command-spinner
```

Usage
-----

[](#usage)

### Adding Loading Spinners to Commands

[](#adding-loading-spinners-to-commands)

Using a loading spinner can be useful for when executing long-running commands, such as fetching data from an API.

To add a loading spinner to your command, first start by adding `HasSpinner` trait to your command. After that, you can then use the `withSpinner()` method like shown in the example below:

```
use AshAllenDesign\CommandSpinner\Traits\HasSpinner;

class YourCommand extends Command
{
    use HasSpinner;

    public function handle(): int
    {
        $this->withSpinner(function () {
            // Run your code here.
        });
    }
}
```

### Adding Text to the Spinner

[](#adding-text-to-the-spinner)

When you're displaying a loading spinner in your console command, you may wish to also display a message.

The example below shows how you can add some text to be displayed alongisde the loading spinner:

```
use AshAllenDesign\CommandSpinner\Traits\HasSpinner;

class YourCommand extends Command
{
    use HasSpinner;

    public function handle(): int
    {
        $this->withSpinner(function () {
            // Run your code here.
        }, 'Fetching data from API...');
    }
}
```

### Customising the Spinner Type

[](#customising-the-spinner-type)

The package comes with many types of loading spinners out of the box that you can use. To view all of the different possible loading spinners, check out the [SpinnerType](/src/Classes/SpinnerType.php) class.

The example below shows how you can choose a different spinner type:

```
use AshAllenDesign\CommandSpinner\Classes\SpinnerType;
use AshAllenDesign\CommandSpinner\Traits\HasSpinner;

class YourCommand extends Command
{
    use HasSpinner;

    public function handle(): int
    {
        $this->withSpinner(function () {
            // Run your code here.
        }, 'Fetching data from API...', SpinnerType::BLOCK_VARIANT_1);
    }
}
```

Examples
--------

[](#examples)

The below example shows you can use the PHP 8 named parameters to add a spinner to your command:

```
use AshAllenDesign\CommandSpinner\Classes\SpinnerType;
use AshAllenDesign\CommandSpinner\Traits\HasSpinner;

class YourCommand extends Command
{
    use HasSpinner;

    public function handle(): int
    {
        $this->withSpinner(
            closure: function () {
                $this->fetchDataFromAPI();
            },
            outputText: 'Fetching data from API...',
            spinnerType: SpinnerType::BLOCK_VARIANT_1
        );
    }
}
```

In the below example, let's imagine that we have a class that calculates something for us and returns it. So, we'll display a loading spinner while it's calculating and then output the result when it's returned.

```
use AshAllenDesign\CommandSpinner\Traits\HasSpinner;

class YourCommand extends Command
{
    use HasSpinner;

    public function handle(): int
    {
        $result = $this->withSpinner(function () {
            return (new Calculator)->calculate();
        });

        $this->line($result);
    }
}
```

Gotchas
-------

[](#gotchas)

Here's a list of a few gotchas that I'm currently aware of at the time of writing this:

- This package's functionality is based on the [spatie/fork](https://github.com/spatie/fork) package which is currently under active development. Therefore, it's possible that the functionality of this package may change if the `fork` package is updated before it's initial release.
- Due to the fact that the package is based on the `fork` package, 2 child PHP processes are created for each spinner that is created. One of them handles the spinning animation, while the other executes the closure that is passed in. This means that because the closure is executed in a child process, it won't be able to directly change any data in the command class itself.
- The `withSpinner()` method currently only allows for primitive types to be returned. Therefore, you can't currently return objects.

Security
--------

[](#security)

If you find any security related issues, please contact me directly at  to report it.

Contribution
------------

[](#contribution)

If you wish to make any changes or improvements to the package, feel free to make a pull request.

To contribute to this library, please use the following guidelines before submitting your pull request:

- Write tests for any new functions that are added. If you are updating existing code, make sure that the existing tests pass and write more if needed.
- Follow [PSR-2](https://www.php-fig.org/psr/psr-2/) coding standards.
- Make all pull requests to the `master` branch.

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

1933d ago

### Community

Maintainers

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

---

Top Contributors

[![ash-jc-allen](https://avatars.githubusercontent.com/u/39652331?v=4)](https://github.com/ash-jc-allen "ash-jc-allen (19 commits)")

---

Tags

laravelartisancommandashallendesignlaravel-command-spinner

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ashallendesign-laravel-command-spinner/health.svg)

```
[![Health](https://phpackages.com/badges/ashallendesign-laravel-command-spinner/health.svg)](https://phpackages.com/packages/ashallendesign-laravel-command-spinner)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6023.2M7](/packages/propaganistas-laravel-disposable-email)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[laravel/sail

Docker files for running a basic Laravel application.

1.9k212.4M1.4k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M293](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M208](/packages/laravel-mcp)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)

PHPackages © 2026

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