Skip to content

Commit 6acde6a

Browse files
author
David Galet
committed
docs: add documentation for Vapor integration
1 parent bf23d5a commit 6acde6a

5 files changed

Lines changed: 50 additions & 0 deletions

File tree

docs/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export default defineConfig({
7575
{text: 'Docker', link: '/docker'},
7676
{text: 'Kubernetes', link: '/kubernetes'},
7777
{text: 'SSH', link: '/ssh'},
78+
{text: 'Vapor', link: '/vapor'},
7879
{text: 'Client Library', link: '/client'},
7980
{text: 'Custom Loaders', link: '/custom-loaders'},
8081
],

docs/getting-started/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Here are some of the features that TweakPHP provides you.
1515
- **Local Run**: Run your PHP code in your local projects.
1616
- **Docker Run**: Run your PHP code inside a docker container.
1717
- **SSH Run**: Run your PHP code inside a remote server via SSH.
18+
- **Vapor Run**: Run your PHP code directly inside Vapor environment, if your project contains a vapor.yml file.
1819
- **Code Editor**: Uses Monaco Editor to write code.
1920
- **LSP**: Uses phpactor to show auto completions when writing code.
2021
- **Themes**: Supports dark and light mode themes.

docs/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ features:
3333
icon:
3434
src: /ssh.svg
3535
details: Run on remote servers
36+
- title: Vapor
37+
icon:
38+
src: /vapor.svg
39+
details: Run your code on environments
3640
- title: Editor
3741
icon:
3842
src: /editor.svg

docs/public/vapor.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/vapor.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Vapor
2+
3+
- [Introduction](#introduction)
4+
- [Connect to Serverless Server](#connect-to-serverless-server)
5+
- [Select Connection](#select-connection)
6+
- [Run Code](#run-code)
7+
- [How it works?](#how-it-works)
8+
9+
## Introduction
10+
11+
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.
12+
13+
::: danger
14+
There are no safety checks or restrictions in place.
15+
**If you select a production environment, the code will be executed directly in that environment.**
16+
Use this feature with caution and verify the selected environment before running any code.
17+
:::
18+
19+
## Connect to Serverless Server
20+
21+
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.
22+
23+
## Select Connection
24+
25+
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.
26+
27+
## Run Code
28+
29+
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.
30+
31+
::: info
32+
Stack trace visualization is disabled when running in Vapor environments and the use of custom loaders is not supported.
33+
:::
34+
35+
## How it works?
36+
37+
TweakPHP leverages the Vapor CLI to run your code inside a selected environment:
38+
1. Reads available environments from the vapor.yml file.
39+
2. Allows the user to select an environment via the interface.
40+
3. Submits the code using a CLI command (vapor tinker cli).
41+
4. Captures and returns the output to the interface.
42+
43+
This approach ensures your code is executed in the same environment as your deployed application, including its runtime, services, and configuration.

0 commit comments

Comments
 (0)