PHPackages                             spatie/laravel-remote - 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. spatie/laravel-remote

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

spatie/laravel-remote
=====================

Execute Artisan commands on remote servers

1.5.0(4mo ago)285101.5k↓33.6%342MITPHPPHP ^8.0CI passing

Since Mar 9Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/spatie/laravel-remote)[ Packagist](https://packagist.org/packages/spatie/laravel-remote)[ Docs](https://github.com/spatie/laravel-remote)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-laravel-remote/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (10)Versions (18)Used By (2)

Execute Artisan commands on remote servers
==========================================

[](#execute-artisan-commands-on-remote-servers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a52566d2e0061383522e45b28e1eeaa2367da3f2c460ec416628d1896acf6e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d72656d6f74652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-remote)[![Total Downloads](https://camo.githubusercontent.com/6921f41e66c5a8eb76f462056456358690b3534b16ceccfbc8f2891af594a4b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d72656d6f74652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-remote)

This package provides a command to execute Artisan command on a remote server.

Here's an example that will clear the cache on the remote server.

```
php artisan remote cache:clear
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/c8d9df30fbdc7bc7cb97402cf8f4b2f6c1b5893fc5a46faeefd9d712dcaa3286/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d72656d6f74652e6a70673f743d32)](https://spatie.be/github-ad-click/laravel-remote)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-remote
```

You can publish the config file with:

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

This is the contents of the published config file:

```
return [
    /*
     * This host will be used if none is specified
     * when executing the `remote` command.
     */
    'default_host' => 'default',

    /*
    * When set to true, A confirmation prompt will be shown before executing the `remote` command.
    */
    'needs_confirmation' => env('REMOTE_NEEDS_CONFIRMATION', false),

    /*
     * Here you can define the hosts where the commands should be executed.
     */
    'hosts' => [
        'default' => [
            'host' => env('REMOTE_HOST'),

            'port' => env('REMOTE_PORT', 22),

            'user' => env('REMOTE_USER'),

            /*
             * The package will cd to the given path before executing the given command.
             */
            'path' => env('REMOTE_PATH'),

            /*
             * Optional. Path to the private key on your computer if your remote server requires it.
             */
            'privateKeyPath' => env('REMOTE_PRIVATE_KEY_PATH'),

            /*
             * Optional. Path to the php binary on your remote server.
             */
            'phpPath' => env('REMOTE_PHP_PATH', 'php'),
        ]
    ],
];
```

Usage
-----

[](#usage)

To execute a command on the remote server use the `remote` Artisan command. You can pass any artisan command that you would like to execute on the server.

Here's an example where we clear the cache.

```
php artisan remote cache:clear
```

### Executing raw commands

[](#executing-raw-commands)

If you want to execute a bash command, use the `--raw` option.

Here we will get a list of files on the server.

```
php artisan remote ls --raw
```

### Using another host

[](#using-another-host)

You can define hosts in the config file. By default, the `default` host is used. To execute a command on another host use the `--host` option.

```
php artisan remote cache:clear --host=my-other-host
```

### Using a jump host

[](#using-a-jump-host)

If you need to connect through a jump host (bastion server), use the `--jump` option.

```
php artisan remote cache:clear --jump=jumphost.example.com
```

### Using options in remote commands

[](#using-options-in-remote-commands)

If you need to use flags or options in the command you're trying to execute, you can wrap the entire command in quotes:

```
php artisan remote --raw "ls -a"
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance76

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 68.6% 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 ~113 days

Recently: every ~184 days

Total

17

Last Release

131d ago

Major Versions

0.0.3 → 1.0.02021-03-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (81 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (6 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (4 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (4 commits)")[![AbdelkaderBah](https://avatars.githubusercontent.com/u/14665300?v=4)](https://github.com/AbdelkaderBah "AbdelkaderBah (3 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (3 commits)")[![rodelias-frete](https://avatars.githubusercontent.com/u/281798633?v=4)](https://github.com/rodelias-frete "rodelias-frete (3 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (2 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (2 commits)")[![xiCO2k](https://avatars.githubusercontent.com/u/823088?v=4)](https://github.com/xiCO2k "xiCO2k (2 commits)")[![majidalaeinia](https://avatars.githubusercontent.com/u/11965368?v=4)](https://github.com/majidalaeinia "majidalaeinia (2 commits)")[![sergiy-petrov](https://avatars.githubusercontent.com/u/8986207?v=4)](https://github.com/sergiy-petrov "sergiy-petrov (1 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![enricodelazzari](https://avatars.githubusercontent.com/u/10452445?v=4)](https://github.com/enricodelazzari "enricodelazzari (1 commits)")[![angeljqv](https://avatars.githubusercontent.com/u/79208641?v=4)](https://github.com/angeljqv "angeljqv (1 commits)")[![mawiswiss](https://avatars.githubusercontent.com/u/6168975?v=4)](https://github.com/mawiswiss "mawiswiss (1 commits)")[![rafa1944](https://avatars.githubusercontent.com/u/3229521?v=4)](https://github.com/rafa1944 "rafa1944 (1 commits)")

---

Tags

spatielaravel-remote

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spatie-laravel-remote/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-laravel-remote/health.svg)](https://phpackages.com/packages/spatie-laravel-remote)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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