Skip to content

Commit 0500cfe

Browse files
committed
Merge pull request #14 from ploi/feature/laravel-zero-12-upgrade
Upgrade to Laravel Zero 12
2 parents 0c9a2a5 + daa78a5 commit 0500cfe

4 files changed

Lines changed: 1373 additions & 890 deletions

File tree

‎CLAUDE.md‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Ploi CLI is a command-line interface for the [Ploi.io](https://ploi.io) server management platform. Built on Laravel Zero (a minimal CLI-focused Laravel framework), it provides 60+ commands for managing servers, sites, databases, SSL, daemons, and more.
8+
9+
## Common Commands
10+
11+
```bash
12+
# Install dependencies
13+
composer install
14+
15+
# Run tests (Pest)
16+
./vendor/bin/pest
17+
18+
# Run a single test file
19+
./vendor/bin/pest tests/Feature/ExampleTest.php
20+
21+
# Lint code (Laravel Pint)
22+
./vendor/bin/pint
23+
24+
# Build standalone executable
25+
php ploi app:build ploi --build-version=<VERSION>
26+
```
27+
28+
## Architecture
29+
30+
### Entry Point
31+
- `/ploi` - Main executable that bootstraps Laravel Zero
32+
- `/bootstrap/app.php` - Application initialization
33+
34+
### Core Services
35+
- `app/Services/PloiAPI.php` - HTTP client for Ploi API (all API communication goes through here)
36+
- `app/Support/Configuration.php` - Manages `.ploi/settings.yml` and `.ploi/provision.yml` project configs
37+
38+
### Command Structure
39+
All commands extend `app/Commands/Command.php` which provides:
40+
- `$this->ploi` - PloiAPI instance
41+
- `$this->configuration` - Configuration instance
42+
- Output helpers: `info()`, `error()`, `success()`, `warn()`
43+
44+
Commands are organized hierarchically:
45+
- `app/Commands/` - Top-level commands (init, deploy, provision, token, ssh:login)
46+
- `app/Commands/Server/` - Server management (create, list, restart, services, etc.)
47+
- `app/Commands/Site/` - Site management (create, list, repos, SSL, env, etc.)
48+
49+
### Command Concerns (Reusable Traits)
50+
Located in `app/Commands/Concerns/`:
51+
- `InteractWithServer` - Server selection and polling logic
52+
- `InteractWithSite` - Site selection and interaction
53+
- `InteractWithDatabase` - Database operations
54+
- `InteractWithUser` - User interaction patterns
55+
56+
### Traits
57+
Located in `app/Traits/`:
58+
- `EnsureHasToken` - Validates API token exists
59+
- `HasPloiConfiguration` - Checks for project config files
60+
- `HasRepo` - Repository-related operations
61+
62+
### Configuration Files
63+
- Global token: `~/.ploi/config.php`
64+
- Project settings: `.ploi/settings.yml` (server ID, site ID, domain)
65+
- Project provisioning: `.ploi/provision.yml` (commands, services)
66+
67+
## Tech Stack
68+
69+
- **PHP 8.2+** with strict typing
70+
- **Laravel Zero 11** - CLI framework
71+
- **Laravel Prompts** - Interactive CLI prompts (select, text, confirm, spin)
72+
- **Guzzle** - HTTP client (via Illuminate HTTP facade)
73+
- **Pest** - Testing framework
74+
- **Laravel Pint** - Code formatter
75+
- **Box** - PHAR builder for standalone executable
76+
77+
## Build Process
78+
79+
Builds are automated via GitHub Actions (`.github/workflows/build.yml`). On push to `main`:
80+
1. Auto-increments version from latest git tag
81+
2. Runs `php ploi app:build ploi --build-version=X.Y`
82+
3. Commits built binary to `builds/ploi`
83+
4. Creates new git tag

‎app/Commands/TokenCommand.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function handle(): void
2323
return;
2424
}
2525

26-
$this->info('Welcome to Ploi.io CLI!');
27-
$this->info('Please enter your Ploi.io API token to get started.');
26+
$this->info('Welcome to Ploi CLI!');
27+
$this->info('Please enter your Ploi API token to get started. Create one here: https://ploi.io/profile/api-keys');
2828

2929
if ($token = $this->option('token')) {
3030
$this->saveToken($token);
@@ -34,7 +34,7 @@ public function handle(): void
3434
}
3535

3636
$token = text(
37-
label: 'Please Enter Your Ploi.io Access Token:',
37+
label: 'Please Enter Your Ploi Access Token:',
3838
required: true,
3939
hint: 'Visit the docs on: https://cli.ploi.io'
4040
);

‎composer.json‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
},
2929
"require-dev": {
3030
"guzzlehttp/guzzle": "^7.9",
31-
"illuminate/http": "^11.33",
31+
"illuminate/http": "^12.0",
3232
"laravel/prompts": "^0.3.6",
3333
"symfony/yaml": "^7.3",
34-
"laravel-zero/framework": "^11.0.3",
34+
"laravel-zero/framework": "^12.0",
3535
"laravel/pint": "^1.24",
3636
"mockery/mockery": "^1.6.12",
3737
"pestphp/pest": "^3.8",
@@ -55,6 +55,9 @@
5555
"optimize-autoloader": true,
5656
"allow-plugins": {
5757
"pestphp/pest-plugin": true
58+
},
59+
"platform": {
60+
"php": "8.2.30"
5861
}
5962
},
6063
"minimum-stability": "stable",

0 commit comments

Comments
 (0)