DEV Community

Milan Felix Šulc for NetrixOne

Posted on

Vercel PHP: PHP 8.4 & PHP 8.5

Back in the ZEIT Now days, I wrote a couple of posts about running PHP on “a frontend platform” and shipping tiny serverless endpoints next to static sites:

Fast-forward: ZEIT is now Vercel, and the community PHP runtime has matured into a pretty practical way to run PHP on Vercel Functions.

And there’s fresh news: v0.8.0 adds PHP 8.4, and v0.9.0 adds PHP 8.5 🎉


What shipped

  • vercel-php@0.8.0PHP 8.4.x
  • vercel-php@0.9.0PHP 8.5.x

Why you might care about PHP 8.4 / 8.5

PHP 8.4 is a major language update with features like property hooks, asymmetric visibility, DOM updates, and general performance/cleanup.

Release notes: https://www.php.net/releases/8.4/en.php

PHP 8.5 (released Nov 20, 2025) adds goodies like a built-in URI extension and the pipe operator (|>), plus other improvements.

Release notes: https://www.php.net/releases/8.5/en.php

If you’re deploying micro-APIs, webhooks, “backend-for-frontend” endpoints, or lightweight PHP apps on Vercel, being able to pin a modern runtime version is a big deal.


The runtime in one sentence

vercel-php is a community runtime that runs your PHP code inside Vercel Functions, with Composer support and a bunch of bundled extensions.

Repo: https://github.com/vercel-community/php/


Quickstart: “Hello PHP” on Vercel (PHP 8.5)

Minimal structure:

project/
├─ api/
│  └─ index.php
└─ vercel.json
Enter fullscreen mode Exit fullscreen mode

api/index.php

<?php

header('content-type: application/json');

echo json_encode([
  'ok'  => true,
  'php' => PHP_VERSION,
  'sapi'=> php_sapi_name(),
]);
Enter fullscreen mode Exit fullscreen mode

vercel.json (pin PHP 8.5)

{
  "functions": {
    "api/*.php": { "runtime": "vercel-php@0.9.0" }
  }
}
Enter fullscreen mode Exit fullscreen mode

Deploy with the Vercel CLI or the Dashboard. Done.

If you want a canonical “works out of the box” demo, there’s also a tiny landing/demo here:

https://php.vercel.app/


Want PHP 8.4 instead?

Same setup—just change the runtime version:

{
  "functions": {
    "api/*.php": { "runtime": "vercel-php@0.8.0" }
  }
}
Enter fullscreen mode Exit fullscreen mode

“Route everything to index.php” (classic app style)

If you’re adapting a small framework/router or want a single entrypoint:

{
  "functions": {
    "api/index.php": { "runtime": "vercel-php@0.9.0" }
  },
  "routes": [{ "src": "/(.*)", "dest": "/api/index.php" }]
}
Enter fullscreen mode Exit fullscreen mode

Composer support (yes)

If you have dependencies:

project/
├─ api/
│  └─ index.php
├─ composer.json
└─ vercel.json
Enter fullscreen mode Exit fullscreen mode

Practical tip: add a .vercelignore and ignore /vendor so you don’t upload it—let the build install deps instead.


Tuning Function limits (duration + memory)

You can configure per-function limits in vercel.json:

{
  "functions": {
    "api/*.php": {
      "runtime": "vercel-php@0.9.0",
      "memory": 1024,
      "maxDuration": 60
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Note: Duration limits depend on your Vercel plan and whether features like Fluid Compute are enabled.

Docs: https://vercel.com/docs/functions/configuring-functions/duration


Overriding php.ini

Need custom INI settings? Drop a php.ini next to your handlers:

api/
├─ index.php
└─ php.ini
Enter fullscreen mode Exit fullscreen mode

Example:

memory_limit=1024M
disable_functions="exec,system"
Enter fullscreen mode Exit fullscreen mode

A couple of gotchas

  • Local dev: the runtime ecosystem historically hasn’t been perfect with vercel dev in every setup. If you hit issues, the simplest fallback is using PHP’s built-in server locally and treating Vercel as your deploy target.
  • Config file choice: Vercel supports vercel.json or vercel.ts (programmatic), but you typically use one configuration approach per project. Docs: https://vercel.com/docs/projects/project-configuration

Upgrading from older pins

If you’re already using vercel-php, upgrading is often just changing the runtime string:

  • vercel-php@0.7.xvercel-php@0.8.0 (PHP 8.4)
  • vercel-php@0.8.xvercel-php@0.9.0 (PHP 8.5)

Then:

  • make sure your composer.json PHP constraint matches (e.g. ^8.4 / ^8.5)
  • run tests
  • deploy to a Preview URL and hit the endpoints

Links

Top comments (0)