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(2mo ago)28384.9k↓23.3%342MITPHPPHP ^8.0CI passing

Since Mar 9Pushed 2mo 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 1mo 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

60

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity51

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

85d 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)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (4 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)")[![majidalaeinia](https://avatars.githubusercontent.com/u/11965368?v=4)](https://github.com/majidalaeinia "majidalaeinia (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)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (2 commits)")[![sergiy-petrov](https://avatars.githubusercontent.com/u/8986207?v=4)](https://github.com/sergiy-petrov "sergiy-petrov (1 commits)")[![mawiswiss](https://avatars.githubusercontent.com/u/6168975?v=4)](https://github.com/mawiswiss "mawiswiss (1 commits)")[![angeljqv](https://avatars.githubusercontent.com/u/79208641?v=4)](https://github.com/angeljqv "angeljqv (1 commits)")[![enricodelazzari](https://avatars.githubusercontent.com/u/10452445?v=4)](https://github.com/enricodelazzari "enricodelazzari (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.9k89.8M1.0k](/packages/spatie-laravel-permission)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[worksome/envy

Automatically keep your .env files in sync.

6871.8M](/packages/worksome-envy)

PHPackages © 2026

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