PHPackages                             regnerisch/laravel-command-hooks - 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. regnerisch/laravel-command-hooks

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

regnerisch/laravel-command-hooks
================================

2.0.0(3y ago)11.6k2ISCPHP

Since Aug 18Pushed 3y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (1)Versions (4)Used By (0)

Laravel Command Hooks
=====================

[](#laravel-command-hooks)

This package adds a `before` and `after` hook to Laravels command class.

Usage
-----

[](#usage)

The methods are only called if they are defined inside you class. If you do not need them, do not implement them. Returning a none zero value inside you `before` method will exit the execution immediately. Neither `handle`/ `__invoke`nor the `after` method will be called. The `after` method will get the exit code of the executed `handle`/ `__invoke` method, you can manipulate the exit code inside the `after` method and overwrite it by returning you own exit code. Returning `null` or nothing will keep the original exit code.

```
use \Regnerisch\LaravelCommandHooks\Command;

class MyCustomCommand extends Command
{
    protected function before(): ?int
    {
        // Do something before the command

        return $code;
    }

    protected function after(int $code): ?int
    {
        // Do something after the command

        return $code;
    }

    // ...
}
```

Contributors
------------

[](#contributors)

- [@regnerisch](https://github.com/regnerisch)
- [@alexgaal](https://github.com/alexgaal)

License
-------

[](#license)

[ISC](LICENSE.md)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~17 days

Total

3

Last Release

1326d ago

Major Versions

1.0.1 → 2.0.02022-09-20

### Community

Maintainers

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

---

Top Contributors

[![regnerisch](https://avatars.githubusercontent.com/u/9422737?v=4)](https://github.com/regnerisch "regnerisch (11 commits)")[![sojeda](https://avatars.githubusercontent.com/u/17851841?v=4)](https://github.com/sojeda "sojeda (1 commits)")

### Embed Badge

![Health badge](/badges/regnerisch-laravel-command-hooks/health.svg)

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

###  Alternatives

[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k47](/packages/nunomaduro-laravel-console-menu)[soloterm/solo

A Laravel package to run multiple commands at once, to aid in local development.

1.2k303.2k4](/packages/soloterm-solo)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)[hmazter/laravel-schedule-list

Laravel package to add command to list all scheduled artisan commands

94432.8k](/packages/hmazter-laravel-schedule-list)[mwguerra/interactive-upgrader

A CLI tool that handles both Composer and npm dependencies for Laravel projects.

1913.7k](/packages/mwguerra-interactive-upgrader)

PHPackages © 2026

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