PHPackages                             sammakescode/laravel-command-switches - 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. sammakescode/laravel-command-switches

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

sammakescode/laravel-command-switches
=====================================

A laravel helper library to allow you to switch commands on and off

v0.1.6(6y ago)37MITPHPPHP &gt;=7.1.0CI failing

Since Jan 31Pushed 6y ago1 watchersCompare

[ Source](https://github.com/SamMakesCode/laravel-command-switches)[ Packagist](https://packagist.org/packages/sammakescode/laravel-command-switches)[ RSS](/packages/sammakescode-laravel-command-switches/feed)WikiDiscussions master Synced today

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

laravel-command-switches
------------------------

[](#laravel-command-switches)

The main purpose of this library is to introduce a stardard way of switching console commands on and off. It's something I regularly want to do in the event of a failing job.

Requirements
============

[](#requirements)

- PHP 7.1+
- Laravel 5.6+

Installation
============

[](#installation)

This library can be installed simply with composer.

`composer require sammakescode/laravel-command-switches`

After installation, run your migrations.

`php artisan migrate`

Usage
=====

[](#usage)

Checking if your command is switched on
---------------------------------------

[](#checking-if-your-command-is-switched-on)

In your command use the `Switchable` trait.

```
    use SamMakesCode\CommandSwitches\Traits\Switchable;
```

You can then use the following functionality to determine if the command has been switched off.

```
    if ($this->isOff()) {
        \Log::notice($this->signature . ' is switched off');
        return;
    }
    // Your functionality
```

You can also use `isOn()`.

```
    if ($this->isOn()) {
        // Your functionality
    }
```

Here's a more complete example to add some context.

```
