PHPackages                             halilcosdu/laravel-command-banner - 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. halilcosdu/laravel-command-banner

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

halilcosdu/laravel-command-banner
=================================

Laravel Command Banner: Prevents Commands from Running in Defined Environments

v1.0.1(1y ago)10275↑130.8%[3 PRs](https://github.com/halilcosdu/laravel-command-banner/pulls)MITPHPPHP ^8.2CI passing

Since May 11Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/halilcosdu/laravel-command-banner)[ Packagist](https://packagist.org/packages/halilcosdu/laravel-command-banner)[ Docs](https://github.com/halilcosdu/laravel-command-banner)[ Fund](https://www.buymeacoffee.com/halilcosdu5)[ RSS](/packages/halilcosdu-laravel-command-banner/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (11)Versions (6)Used By (0)

★ Laravel Command Banner: Prevents commands from running in defined environments
================================================================================

[](#-laravel-command-banner-prevents-commands-from-running-in-defined-environments)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e6cbbe65f2ea2d05d845c8d833d563a50d1e456a1d6efb96dfdca98733c732a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68616c696c636f7364752f6c61726176656c2d636f6d6d616e642d62616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu/laravel-command-banner)[![GitHub Tests Action Status](https://camo.githubusercontent.com/04cc3e7189d1dd82397603c1c102af0f5f28365156f89556f3e607c20be7ecbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d636f6d6d616e642d62616e6e65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-command-banner/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/01193384754c7aaccf43e284cf47c95b0304a4b14315a947ac61dd7bdc62258c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d636f6d6d616e642d62616e6e65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-command-banner/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a23be22494760eedf44afa97e2945a68653b3b09d540d2cc13f8f217be820f43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68616c696c636f7364752f6c61726176656c2d636f6d6d616e642d62616e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu/laravel-command-banner)

The "Laravel Command Banner" is a package designed to provide control over the execution of artisan commands in different environments. It allows developers to define which commands should be prevented from running in specific environments, enhancing the security and stability of the application. The package works by listening to the CommandStarting event in Laravel. When a command is about to start, it checks the package's configuration to see if the command is allowed to run in the current environment. If the command is not allowed, it outputs an error message and stops the execution of the command. This package is particularly useful in scenarios where certain commands can have destructive effects if run in the wrong environment, such as a production environment. By using this package, developers can ensure that such commands are only run in safe environments, such as local or staging environments.

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

[](#installation)

You can install the package via composer:

```
composer require halilcosdu/laravel-command-banner
```

You can publish the config file with:

```
php artisan vendor:publish --tag="command-banner-config"
```

This is the contents of the published config file:

You can add as many environments and different commands to the configuration file as you need.

The package will prevent the commands listed in the configuration file from running in the specified environments.

```
