PHPackages                             paymeservice/remotisan - 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. paymeservice/remotisan

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

paymeservice/remotisan
======================

Executing Artisan commands interactively

2.4.1(4mo ago)129443[3 PRs](https://github.com/PayMeService/remotisan/pulls)MITPHPPHP ^8.1|^8.2CI passing

Since Nov 21Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/PayMeService/remotisan)[ Packagist](https://packagist.org/packages/paymeservice/remotisan)[ Docs](https://github.com/paymeservice/remotisan)[ RSS](/packages/paymeservice-remotisan/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (45)Used By (0)

Remote Execution of Artisan commands
====================================

[](#remote-execution-of-artisan-commands)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a89d7f7703d45d3ab89b1822d51d3611eb338bbad682107732166f42a727fafb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061796d65736572766963652f72656d6f746973616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/paymeservice/remotisan)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0f0eff91650b721a5dd34cc269df3b31bf7b61e17f1deb3fc349d7e10f84f6c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7061796d65736572766963652f72656d6f746973616e2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/paymeservice/remotisan/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d998c7f084ce71444eaca3556e41b7b1f25ab69facebbb124125783dfcd6d215/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7061796d65736572766963652f72656d6f746973616e2f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/paymeservice/remotisan/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2b271fa40731f9280077f33d3545b76ec492ac6d6217a917749b19446965286e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061796d65736572766963652f72656d6f746973616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/paymeservice/remotisan)

The package allows you to execute artisan commands remotely, using HTTP, and receiving propagating output on the page.

**Your command execution won't run into server's MAX\_EXECUTION\_TIME**, allowing you to preserve original server configuration.

In general, the package could very well assist transitioning your project to CI/CD with auto-scaling, when support/devops/developers have no direct access to the server terminal.

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

[](#installation)

Use composer to install *Remotisan* to your Laravel project. **PHP 8.0+ is required**.

```
composer require paymeservice/remotisan
```

You can ( and probably should;) ) publish the config file with:

```
php artisan vendor:publish --tag="remotisan-config"
```

Optionally, you can publish the views using. The views will be published into ***/resources/views/vendor/remotisan/*** directory for your further adjustments.

```
php artisan vendor:publish --tag="remotisan-views"
```

Assets Building
---------------

[](#assets-building)

After making any changes to React components or frontend assets, rebuild the assets for production:

```
npm run build
```

This will generate optimized production assets in the `dist/` directory. The build process is required for any modifications to:

- React components in `resources/react/components/`
- JavaScript files
- CSS/styling changes

Configuration
-------------

[](#configuration)

Remotisan supports **two approaches** for command permissions:

### 1. Attribute-Based Permissions (Recommended)

[](#1-attribute-based-permissions-recommended)

For your **custom commands**, use PHP 8.0+ attributes directly in your command classes:

```
use PayMe\Remotisan\Attributes\RemotisanRoles;

#[RemotisanRoles(['admin', 'user'])]
class MyCustomCommand extends Command
{
    protected $signature = 'my:command';

    public function handle()
    {
        // Your command logic
    }
}
```

**Available permission patterns:**

```
#[RemotisanRoles(['*'])]              // All roles can execute
#[RemotisanRoles(['admin'])]          // Admin role only
#[RemotisanRoles(['8'])]              // Permission constant as string
#[RemotisanRoles(['admin', 'user'])]  // Multiple specific roles
```

### 2. Config-Based Permissions

[](#2-config-based-permissions)

For **Laravel base commands** (migrate, cache:clear, etc.), use the traditional config approach:

```
// config/remotisan.php
[
    "commands" =>   [
        "allowed" => [ // command level ACL.
            "COMMAND_NAME"            => ["roles" => [UserRoles::TECH_SUPPORT]],
            "COMMAND_FOR_DEVOPS_ONLY" => ["roles" => [UserRoles::DEV_OPS]],
            "COMMAND_SHARED"          => ["roles" => [UserRoles::TECH_SUPPORT, UserRoles::DEV_OPS]]
        ]
    ]
]
```

### Security-First Approach

[](#security-first-approach)

- **Commands with attributes**: Only specified roles can execute
- **Commands with config**: Only configured roles can execute
- **Commands without either**: **DENIED by default** (secure by default)
- **Both approaches**: Can be used simultaneously - results are merged

### Commands Cache (Performance Optimization)

[](#commands-cache-performance-optimization)

For improved performance in production, Remotisan supports loading commands from a cache file. This avoids expensive reflection operations and ensures all commands from your project and packages are available.

**Cache File Location**: `bootstrap/cache/commands.php`

**Cache File Format**:

```
