Deploy Tipsy as a serverless PHP function using the vercel-php community runtime.
The example composer.json uses a path repository for local monorepo development. Vercel builds cannot resolve that path. Before deploying:
- Publish
tipsyphp/tipsy^2.0to Packagist (or a VCS repo Vercel can reach), then - Replace the path repository with a normal constraint:
{
"require": {
"php": ">=8.3",
"tipsyphp/tipsy": "^2.0"
}
}# Install Vercel CLI
npm i -g vercel
# Deploy (after Packagist require is in place)
cd examples/vercel
vercelcd examples/vercel
composer install
php -S localhost:8000 -t apivercel.json → routes all requests to api/index.php
api/index.php → Tipsy entry point (handles all routing)
composer.json → vercel-php installs deps automatically during build
Vercel spins up a serverless function per request. Tipsy's low overhead (sub-millisecond bootstrap) makes it a good fit for cold starts.
| Route | Method | Description |
|---|---|---|
/ |
GET | API info + available routes |
/hello/:name |
GET | Greeting with route param |
/time |
GET | Current UTC time |
/echo |
POST | Echoes back your JSON body |
/health |
GET | Health check |