From 6acde6adaca864ffc50ae6da827ac16d6fdb0af9 Mon Sep 17 00:00:00 2001 From: David Galet Date: Sat, 7 Jun 2025 23:49:03 +0200 Subject: [PATCH] docs: add documentation for Vapor integration --- docs/.vitepress/config.mts | 1 + docs/getting-started/introduction.md | 1 + docs/index.md | 4 +++ docs/public/vapor.svg | 1 + docs/vapor.md | 43 ++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 docs/public/vapor.svg create mode 100644 docs/vapor.md diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 59ef386..923b729 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -75,6 +75,7 @@ export default defineConfig({ {text: 'Docker', link: '/docker'}, {text: 'Kubernetes', link: '/kubernetes'}, {text: 'SSH', link: '/ssh'}, + {text: 'Vapor', link: '/vapor'}, {text: 'Client Library', link: '/client'}, {text: 'Custom Loaders', link: '/custom-loaders'}, ], diff --git a/docs/getting-started/introduction.md b/docs/getting-started/introduction.md index 0814899..4bcf775 100644 --- a/docs/getting-started/introduction.md +++ b/docs/getting-started/introduction.md @@ -15,6 +15,7 @@ Here are some of the features that TweakPHP provides you. - **Local Run**: Run your PHP code in your local projects. - **Docker Run**: Run your PHP code inside a docker container. - **SSH Run**: Run your PHP code inside a remote server via SSH. +- **Vapor Run**: Run your PHP code directly inside Vapor environment, if your project contains a vapor.yml file. - **Code Editor**: Uses Monaco Editor to write code. - **LSP**: Uses phpactor to show auto completions when writing code. - **Themes**: Supports dark and light mode themes. diff --git a/docs/index.md b/docs/index.md index 1dd1de5..26bb36d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,6 +33,10 @@ features: icon: src: /ssh.svg details: Run on remote servers + - title: Vapor + icon: + src: /vapor.svg + details: Run your code on environments - title: Editor icon: src: /editor.svg diff --git a/docs/public/vapor.svg b/docs/public/vapor.svg new file mode 100644 index 0000000..0c438e3 --- /dev/null +++ b/docs/public/vapor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/vapor.md b/docs/vapor.md new file mode 100644 index 0000000..082c16a --- /dev/null +++ b/docs/vapor.md @@ -0,0 +1,43 @@ +# Vapor + +- [Introduction](#introduction) +- [Connect to Serverless Server](#connect-to-serverless-server) +- [Select Connection](#select-connection) +- [Run Code](#run-code) +- [How it works?](#how-it-works) + +## Introduction + +TweakPHP supports running PHP code directly inside a Laravel Vapor environment with vapor tinker cli. This allows you to test and execute code within the same context as your deployed serverless infrastructure. + +::: danger +There are no safety checks or restrictions in place. +**If you select a production environment, the code will be executed directly in that environment.** +Use this feature with caution and verify the selected environment before running any code. +::: + +## Connect to Serverless Server + +To connect to a Vapor environment, make sure your project contains a valid vapor.yml file at its root. TweakPHP will automatically detect environments from vapor file. + +## Select Connection + +Once a vapor.yml file is detected, TweakPHP automatically extracts the available environments and displays them in the environment selection dropdown. The Vapor CLI is used behind the scenes to establish the connection. + +## Run Code + +Select the desired environment, write your PHP code in the editor without including `` tags — TweakPHP will handle them automatically if they are present. Once ready, click Run or hit `Command+R` on mac or `Ctrl+R` to execute the code inside the selected Vapor environment. The output will be streamed back to the interface. + +::: info +Stack trace visualization is disabled when running in Vapor environments and the use of custom loaders is not supported. +::: + +## How it works? + +TweakPHP leverages the Vapor CLI to run your code inside a selected environment: +1. Reads available environments from the vapor.yml file. +2. Allows the user to select an environment via the interface. +3. Submits the code using a CLI command (vapor tinker cli). +4. Captures and returns the output to the interface. + +This approach ensures your code is executed in the same environment as your deployed application, including its runtime, services, and configuration.