PHPackages                             philo/artisan-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. [API Development](/categories/api)
4. /
5. philo/artisan-remote

ActiveLibrary[API Development](/categories/api)

philo/artisan-remote
====================

An HTTP API to interact with Laravel Artisan commands.

v1.0.2(5y ago)8230.2k↓28.1%7[1 issues](https://github.com/PhiloNL/artisan-remote/issues)MITPHPPHP ^7.3.0|^8.0

Since Dec 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/PhiloNL/artisan-remote)[ Packagist](https://packagist.org/packages/philo/artisan-remote)[ RSS](/packages/philo-artisan-remote/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

[![](https://user-images.githubusercontent.com/1133950/101284994-37e83200-37e3-11eb-9475-3327d204a24f.png)](https://philo.dev)

[![Build Status](https://github.com/PhiloNL/artisan-remote/workflows/PHPUnit/badge.svg)](https://github.com/PhiloNL/artisan-remote/actions)[![Total Downloads](https://camo.githubusercontent.com/01992b1f2842dcd22646b81be3b95639f9afb90fadc040a3fc32cac408e6f52e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068696c6f2f6172746973616e2d72656d6f7465)](https://packagist.org/packages/philo/artisan-remote)[![Latest Stable Version](https://camo.githubusercontent.com/de1c651628e9b9c74bd8cc59b559a9bc9e867df28df6c67e18afdf13659530f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068696c6f2f6172746973616e2d72656d6f7465)](https://packagist.org/packages/philo/artisan-remote)[![License](https://camo.githubusercontent.com/48bae4bbbb5c09ed0559fcaf0317da1574c0752aaa4c80fcf8e78532cc3bd1cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068696c6f2f6172746973616e2d72656d6f7465)](https://packagist.org/packages/philo/artisan-remote)

About Artisan Remote
--------------------

[](#about-artisan-remote)

Artisan Remote is a package for Laravel to interact with your Artisan Commands via an HTTP API.

Artisan Remote Desktop
----------------------

[](#artisan-remote-desktop)

[![](https://user-images.githubusercontent.com/1133950/101404659-38fa8b80-38d7-11eb-9fef-89784960b433.png)](https://unlock.sh/download/artisan-remote)

If you want an easy way to interact with your Artisan commands via the UI, be sure to download the desktop app, which integrates with the Artisan Remote API.

- Execute commands with just a click.
- Provider command parameters via simple input fields.
- Track output of previously executed commands.
- Supports unlimited Laravel application.
- Your application environment details in one single overview.
- Works on Mac, Windows and Linux.

[Download for Mac, Windows or Linux](https://unlock.sh/download/artisan-remote) distribution via [Unlock](https://unlock.sh).

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

[](#installation)

To get started, require the package via Composer:

```
composer require philo/artisan-remote

```

API endpoints
-------------

[](#api-endpoints)

The environment endpoint will return information about your application environment, like your PHP and Laravel version.

```
GET /artisan-remote/environment

Content-Type: application/json
Accept: application/json
Authorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc

{
  "applicationName": "Unlock.sh",
  "phpVersion": "7.4.12",
  "frameworkVersion": "7.28.1",
  "environment": "production",
  "inMaintenanceMode": true,
  "maxExecutionTime": "30"
}
```

Get a list of the available commands. You can define the commands you want to make available in the `artisan-remote.php` config file.

```
GET /artisan-remote/commands

Content-Type: application/json
Accept: application/json
Authorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc

[
  {
    "name": "down",
    "description": "Put the application into maintenance mode",
    "arguments": [],
    "options": [
      {
        "name": "message",
        "description": "The message for the maintenance mode",
        "default": null,
        "isArray": false,
        "isRequired": false,
        "isOptional": true
      },
      {
        "name": "retry",
        "description": "The number of seconds after which the request may be retried",
        "default": null,
        "isArray": false,
        "isRequired": false,
        "isOptional": true
      },
      {
        "name": "allow",
        "description": "IP or networks allowed to access the application while in maintenance mode",
        "default": [],
        "isArray": true,
        "isRequired": false,
        "isOptional": true
      }
    ]
  },
  {
    "name": "up",
    "description": "Bring the application out of maintenance mode",
    "arguments": [],
    "options": []
  }
]
```

And finally, you can use the invoke endpoint to execute your command.

```
POST /artisan-remote/commands/invoke

Content-Type: application/json
Accept: application/json
Authorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc

{
  "name": "down",
  "options": {
    "message": "We will be back in 15 minutes",
    "retry": "900",
    "allow": [
      "127.0.0.1"
    ]
  }
}

// Response
{
  "rawCommandOutput": "\u001b[33mApplication is now in maintenance mode.\u001b[39m\n",
  "HtmlCommandOutput": "Application is now in maintenance mode.\n",
  "exitCode": 0,
  "executionTime": 0.017518997192382812
}
```

API authorization
-----------------

[](#api-authorization)

Before you can make requests to the API endpoints, you need to set up authorization. You can authorize access to specific commands in the `artisan-remote.php` config file. For example, you might want to allow your client to run the artisan up and down commands.

```
