{"id":17914744,"url":"https://github.com/philonl/artisan-remote","last_synced_at":"2025-03-23T23:30:53.270Z","repository":{"id":46569708,"uuid":"276870986","full_name":"PhiloNL/artisan-remote","owner":"PhiloNL","description":"Artisan Remote is a package for Laravel to interact with your Artisan Commands via an HTTP API.","archived":false,"fork":false,"pushed_at":"2021-10-05T12:28:20.000Z","size":84,"stargazers_count":78,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T00:24:51.122Z","etag":null,"topics":["artisan","laravel","laravel-package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhiloNL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-03T10:18:18.000Z","updated_at":"2024-10-10T08:28:39.000Z","dependencies_parsed_at":"2022-09-23T03:24:05.271Z","dependency_job_id":null,"html_url":"https://github.com/PhiloNL/artisan-remote","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhiloNL%2Fartisan-remote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhiloNL%2Fartisan-remote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhiloNL%2Fartisan-remote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhiloNL%2Fartisan-remote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhiloNL","download_url":"https://codeload.github.com/PhiloNL/artisan-remote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186471,"owners_count":20574551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artisan","laravel","laravel-package","php"],"created_at":"2024-10-28T19:59:37.633Z","updated_at":"2025-03-23T23:30:52.851Z","avatar_url":"https://github.com/PhiloNL.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://philo.dev\" target=\"_blank\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/1133950/101284994-37e83200-37e3-11eb-9475-3327d204a24f.png\" width=\"150\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/PhiloNL/artisan-remote/actions\"\u003e\u003cimg src=\"https://github.com/PhiloNL/artisan-remote/workflows/PHPUnit/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/philo/artisan-remote\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/philo/artisan-remote\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/philo/artisan-remote\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/philo/artisan-remote\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/philo/artisan-remote\"\u003e\u003cimg src=\"https://img.shields.io/packagist/l/philo/artisan-remote\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## About Artisan Remote\nArtisan Remote is a package for Laravel to interact with your Artisan Commands via an HTTP API.\n\n## Artisan Remote Desktop \n\u003cp align=\"center\"\u003e\u003ca href=\"https://unlock.sh/download/artisan-remote\" target=\"_blank\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/1133950/101404659-38fa8b80-38d7-11eb-9fef-89784960b433.png\"\u003e\u003c/a\u003e\u003c/p\u003e\n\nIf 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.\n\n- Execute commands with just a click.\n- Provider command parameters via simple input fields.\n- Track output of previously executed commands.\n- Supports unlimited Laravel application.\n- Your application environment details in one single overview. \n- Works on Mac, Windows and Linux.\n\n[Download for Mac, Windows or Linux](https://unlock.sh/download/artisan-remote) distribution via [Unlock](https://unlock.sh).\n\n## Installation\nTo get started, require the package via Composer:\n\n```\ncomposer require philo/artisan-remote\n```\n\n## API endpoints\nThe environment endpoint will return information about your application environment, like your PHP and Laravel version. \n```json\nGET /artisan-remote/environment\n\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc\n\n{\n  \"applicationName\": \"Unlock.sh\",\n  \"phpVersion\": \"7.4.12\",\n  \"frameworkVersion\": \"7.28.1\",\n  \"environment\": \"production\",\n  \"inMaintenanceMode\": true,\n  \"maxExecutionTime\": \"30\"\n}\n```\n\nGet a list of the available commands. You can define the commands you want to make available in the `artisan-remote.php` config file.\n \n```json\nGET /artisan-remote/commands\n\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc\n\n[\n  {\n    \"name\": \"down\",\n    \"description\": \"Put the application into maintenance mode\",\n    \"arguments\": [],\n    \"options\": [\n      {\n        \"name\": \"message\",\n        \"description\": \"The message for the maintenance mode\",\n        \"default\": null,\n        \"isArray\": false,\n        \"isRequired\": false,\n        \"isOptional\": true\n      },\n      {\n        \"name\": \"retry\",\n        \"description\": \"The number of seconds after which the request may be retried\",\n        \"default\": null,\n        \"isArray\": false,\n        \"isRequired\": false,\n        \"isOptional\": true\n      },\n      {\n        \"name\": \"allow\",\n        \"description\": \"IP or networks allowed to access the application while in maintenance mode\",\n        \"default\": [],\n        \"isArray\": true,\n        \"isRequired\": false,\n        \"isOptional\": true\n      }\n    ]\n  },\n  {\n    \"name\": \"up\",\n    \"description\": \"Bring the application out of maintenance mode\",\n    \"arguments\": [],\n    \"options\": []\n  }\n]\n```\n\nAnd finally, you can use the invoke endpoint to execute your command.\n\n```json\nPOST /artisan-remote/commands/invoke\n\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer 039ede05-d2c1-4ab4-8869-945e805e6bbc\n\n{\n  \"name\": \"down\",\n  \"options\": {\n    \"message\": \"We will be back in 15 minutes\",\n    \"retry\": \"900\",\n    \"allow\": [\n      \"127.0.0.1\"\n    ]\n  }\n}\n\n// Response\n{\n  \"rawCommandOutput\": \"\\u001b[33mApplication is now in maintenance mode.\\u001b[39m\\n\",\n  \"HtmlCommandOutput\": \"\u003cspan style=\\\"background-color: transparent; color: #e5e510\\\"\u003eApplication is now in maintenance mode.\u003c\\/span\u003e\u003cspan style=\\\"background-color: transparent; color: #e5e5e5\\\"\u003e\\n\u003c\\/span\u003e\",\n  \"exitCode\": 0,\n  \"executionTime\": 0.017518997192382812\n}\n```\n\n## API authorization\nBefore 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.\n\n```php\n\u003c?php\n\nreturn [\n    'commands'     =\u003e [\n        \\Illuminate\\Foundation\\Console\\UpCommand::class,\n        \\Illuminate\\Foundation\\Console\\DownCommand::class,\n        \\Illuminate\\Cache\\Console\\ClearCommand::class,\n    ],\n    'auth'         =\u003e [\n        // This API token will be able to access only the up and down command.\n        '79e9ab08-bdc0-4bef-8af2-5e5b5579f9af' =\u003e [\n            \\Illuminate\\Foundation\\Console\\UpCommand::class,\n            \\Illuminate\\Foundation\\Console\\DownCommand::class,\n        ],\n        // This API token will be able to access the up, down and cache:clear command.\n        '3c562cb3-62ba-4fe4-9875-528ecae6e8b4' =\u003e ['*'],\n    ],\n    'route_prefix' =\u003e 'artisan-remote',\n];\n```\n\nIt's best practice not to include any credentials directly in your configuration file, so make sure to use environment variables in production.\n\n```php\n// artisan-remote.php\n'auth'         =\u003e [\n    env('CLIENT_ARTISAN_REMOTE_API_KEY') =\u003e [\n        \\Illuminate\\Foundation\\Console\\UpCommand::class,\n        \\Illuminate\\Foundation\\Console\\DownCommand::class,\n    ],\n]\n\n// .env\nCLIENT_ARTISAN_REMOTE_API_KEY=79e9ab08-bdc0-4bef-8af2-5e5b5579f9af\n```\n\n\n##### Running commands when your application is in maintenance mode\nBy default, you will not be able to execute commands when your application is in maintenance. To run commands while your application is in maintenance mode, you will need to adjust the CheckForMaintenanceMode middleware.\n\n```php\n// app/Http/Middleware/CheckForMaintenanceMode.php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode as Middleware;\n\nclass CheckForMaintenanceMode extends Middleware\n{\n    /**\n     * The URIs that should be reachable while maintenance mode is enabled.\n     *\n     * @var array\n     */\n    protected $except = [\n        'artisan-remote/*'\n    ];\n}\n```\n \n\n## Credits\n- [Philo Hermans](https://github.com/philoNL)\n- [All Contributors](../../contributors)\n\n## License\nArtisan Remote is open-sourced software licensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilonl%2Fartisan-remote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilonl%2Fartisan-remote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilonl%2Fartisan-remote/lists"}