Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
],
Expand Down
1 change: 1 addition & 0 deletions docs/getting-started/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/public/vapor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions docs/vapor.md
Original file line number Diff line number Diff line change
@@ -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 `<?php` or `?>` 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.