{"id":13474475,"url":"https://github.com/vercel-community/php","last_synced_at":"2025-05-14T13:05:50.355Z","repository":{"id":37809434,"uuid":"199048926","full_name":"vercel-community/php","owner":"vercel-community","description":"🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)","archived":false,"fork":false,"pushed_at":"2024-10-19T10:43:20.000Z","size":112195,"stargazers_count":1338,"open_issues_count":43,"forks_count":309,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-14T09:46:14.126Z","etag":null,"topics":["aws","lambda","php","runtime","serverless","vercel"],"latest_commit_sha":null,"homepage":"https://php.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vercel-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-26T16:31:08.000Z","updated_at":"2025-05-13T04:51:22.000Z","dependencies_parsed_at":"2024-04-16T07:39:55.194Z","dependency_job_id":"448db2e5-8ea1-4cf3-a783-88373cd5fa9e","html_url":"https://github.com/vercel-community/php","commit_stats":{"total_commits":344,"total_committers":18,"mean_commits":19.11111111111111,"dds":"0.36046511627906974","last_synced_commit":"27afa9df6a2cad6b3cdc95672f9ff5bb01d02232"},"previous_names":["juicyfx/vercel-php","juicyfx/now-php"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel-community%2Fphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel-community%2Fphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel-community%2Fphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel-community%2Fphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel-community","download_url":"https://codeload.github.com/vercel-community/php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149949,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","lambda","php","runtime","serverless","vercel"],"created_at":"2024-07-31T16:01:12.616Z","updated_at":"2025-05-14T13:05:50.316Z","avatar_url":"https://github.com/vercel-community.png","language":"TypeScript","readme":"\u003ch1 align=center\u003ePHP Runtime for \u003ca href=\"https://vercel.com\"\u003eVercel\u003c/h1\u003e\n\n\u003cp align=center\u003e\n  Enjoyable \u0026 powerful 🐘 PHP Runtime (\u003ca href=\"https://php.vercel.app\"\u003ephp.vercel.app\u003c/a\u003e) for Vercel platform.\n\u003c/p\u003e\n\n\u003cp align=center\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vercel-php\"\u003e\u003cimg src=\"https://badgen.net/npm/v/vercel-php\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/vercel-php\"\u003e\u003cimg src=\"https://badgen.net/npm/dt/vercel-php\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/juicyfx/vercel-php/actions\"\u003e\u003cimg src=\"https://badgen.net/github/checks/juicyfx/vercel-php\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://bit.ly/f3l1xdis\"\u003e\u003cimg src=\"https://badgen.net/badge/support/discussions/yellow\"\u003e\u003c/a\u003e\n\t\u003ca href=\"http://bit.ly/f3l1xsponsor\"\u003e\u003cimg src=\"https://badgen.net/badge/sponsor/donations/F96854\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=center\u003e\n  \u003ca href=\"https://github.com/nette\"\u003e\u003cimg src=\"https://github.com/nette.png\" width=\"128\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/symfony\"\u003e\u003cimg src=\"https://github.com/symfony.png\" width=\"128\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/illuminate\"\u003e\u003cimg src=\"https://github.com/illuminate.png\" width=\"128\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/slimphp\"\u003e\u003cimg src=\"https://github.com/slimphp.png\" width=\"128\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/phalcon\"\u003e\u003cimg src=\"https://github.com/phalcon.png\" width=\"128\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=center\u003e\u003cstrong\u003e🏋️‍♀️ It works with these frameworks and tools. Discover more at \u003ca href=\"https://github.com/juicyfx/vercel-examples\"\u003eexamples\u003c/a\u003e.\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp align=center\u003e\nMade with  ❤️  by \u003ca href=\"https://github.com/f3l1x\"\u003e@f3l1x\u003c/a\u003e (\u003ca href=\"https://f3l1x.io\"\u003ef3l1x.io\u003c/a\u003e) • 🐦 \u003ca href=\"https://twitter.com/xf3l1x\"\u003e@xf3l1x\u003c/a\u003e\n\u003c/p\u003e\n\n-----\n\n## 😎 Getting Started\n\nLet's picture you want to deploy your awesome microproject written in PHP and you don't know where. You have found [Vercel](https://vercel.com) it's awesome, but for static sites. Not anymore! I would like to introduce you your new best friend `vercel-php`, PHP runtime for Vercel platform.\n\nMost simple example project is this one, using following project structure.\n\n```sh\nproject\n├── api\n│   └── index.php\n└── vercel.json\n```\n\nFirst file `api/index.php` is entrypoint of our application. It should be placed in **api** folder, it's very standard location for Vercel.\n\n```php\n\u003c?php\nphpinfo();\n```\n\nSecond file `vercel.json` is pure gold here. Setup your project with configuration like this and voila. That's all.\n\n```json\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  }\n}\n```\n\nLast thing you have to do is call `vercel`. If you are more interested take a look at features and usage.\n\n```\n# Install it globally\nnpm i -g vercel\n\n# Log in\nvercel login\n\n# Let's fly\nvercel\n```\n\nAre you ready to deploy your first PHP project to Vercel? Click \u0026 Go!\n\n\u003ca href=\"https://vercel.com/new/clone?repository-url=https://github.com/juicyfx/vercel-examples/tree/master/php\"\u003e\u003cimg src=\"https://vercel.com/button\"\u003e\u003c/a\u003e\n\n## 🤗 Features\n\n- **Architecture**: PHP development server (🚀 fast enough)\n- **PHP version**: 8.3 (https://example-php-8-3.vercel.app)\n- **Extensions**: apcu, bcmath, brotli, bz2, calendar, Core, ctype, curl, date, dom, ds, exif, fileinfo, filter, ftp, geoip, gettext, hash, iconv, igbinary, imap, intl, json, libxml, lua, mbstring, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, protobuf, readline, redis, Reflection, runkit7, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, swoole, timecop, tokenizer, uuid, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zlib, zip\n- **Speed**: cold ~250ms / warm ~5ms\n- **Memory**: ~90mb\n- **Frameworks**: Nette, Symfony, Lumen, Slim, Phalcon\n\n\u003e List of all installable extensions is on this page https://blog.remirepo.net/pages/PECL-extensions-RPM-status.\n\n## 💯 Versions\n\n- `vercel-php@0.7.3` - Node autodetect / PHP 8.3.x (https://example-php-8-3.vercel.app)\n- `vercel-php@0.6.2` - Node autodetect / PHP 8.2.x (https://example-php-8-2.vercel.app)\n- `vercel-php@0.5.5` - Node autodetect / PHP 8.1.x (https://example-php-8-1.vercel.app)\n- `vercel-php@0.4.4` - Node autodetect / PHP 8.0.x (https://example-php-8-0.vercel.app)\n- `vercel-php@0.3.6` - Node autodetect / PHP 7.4.x (https://example-php-7-4.vercel.app)\n\n## ⚙️  Usage\n\nBefore you can start using this runtime, you should learn about Vercel and [how runtimes](https://vercel.com/docs/runtimes?query=runtime#official-runtimes) works. Take a look at blogpost about [`Serverless Functions`](https://vercel.com/blog/customizing-serverless-functions).\n\nYou should define `functions` property in `vercel.json` and list PHP files directly or using wildcard (*).\nIf you need to route everything to index, use `routes` property.\n\n```json\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  },\n  \"routes\": [\n    { \"src\": \"/(.*)\",  \"dest\": \"/api/index.php\" }\n  ]\n}\n```\n\nDo you have more questions (❓)? Let's move to [FAQ](#%EF%B8%8F-faq).\n\n## 👨‍💻 `vercel dev`\n\nFor running `vercel dev` properly, you need to have PHP installed on your computer, [learn more](errors/now-dev-no-local-php.md).\nBut it's PHP and as you know PHP has built-in development server. It works out of box.\n\n```\nphp -S localhost:8000 api/index.php\n```\n\n## 👀 Demo\n\n- official - https://php.vercel.app/\n- phpinfo - https://phpshow.vercel.app/\n- extensions - https://phpshow.vercel.app/ext/\n- ini - https://phpshow.vercel.app/ini/\n- JSON API - https://phpshow.vercel.app/api/users.php\n- test - https://phpshow.vercel.app/test.php\n\n![PHP](https://api.microlink.io?url=https://phpshow.vercel.app\u0026screenshot\u0026embed=screenshot.url)\n\n## 🎯Examples\n\n- [PHP - fast \u0026 simple](https://github.com/juicyfx/vercel-examples/tree/master/php/)\n- [Composer - install dependencies](https://github.com/juicyfx/vercel-examples/tree/master/php-composer/)\n- [Framework - Laravel](https://github.com/juicyfx/vercel-examples/blob/master/php-laravel)\n- [Framework - Lumen](https://github.com/juicyfx/vercel-examples/blob/master/php-lumen)\n- [Framework - Nette](https://github.com/juicyfx/vercel-examples/blob/master/php-nette-tracy)\n- [Framework - Phalcon](https://github.com/juicyfx/vercel-examples/blob/master/php-phalcon)\n- [Framework - Slim](https://github.com/juicyfx/vercel-examples/blob/master/php-slim)\n- [Framework - Symfony - Microservice](https://github.com/juicyfx/vercel-examples/blob/master/php-symfony-microservice)\n\nBrowse [more examples](https://github.com/juicyfx/vercel-examples). 👀\n\n## 📜 Resources\n\n- [2019/10/23 - Code Examples](https://github.com/trainit/2019-10-hubbr-zeit)\n- [2019/10/19 - ZEIT - Deploy Serverless Microservices Right Now](https://slides.com/f3l1x/2019-10-19-zeit-deploy-serverless-microservices-right-now-vol2)\n- [2019/08/23 - Code Examples](https://github.com/trainit/2019-08-serverless-zeit-now)\n- [2019/07/07 - Bleeding Edge PHP on ZEIT Now](https://dev.to/nx1/bleeding-edge-php-on-zeit-now-565g)\n- [2019/06/06 - Code Examples](https://github.com/trainit/2019-06-zeit-now)\n- [2019/06/05 - ZEIT - Deploy Serverless Microservices Right Now](https://slides.com/f3l1x/2019-06-05-zeit-deploy-serverless-microservices-right-now) ([VIDEO](https://www.youtube.com/watch?v=IwhEGNDx3aE))\n\n## 🚧 Roadmap\n\nSee [roadmap issue](https://github.com/juicyfx/vercel-php/issues/3). Help wanted.\n\n## ⁉️ FAQ\n\n\u003cdetails\u003e\n  \u003csummary\u003e1. How to use more then one endpoint (index.php)?\u003c/summary\u003e\n\n```sh\nproject\n├── api\n│   ├── index.php\n│   ├── users.php\n│   └── books.php\n└── vercel.json\n```\n\n```\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    },\n\n    // Can be list also directly\n\n    \"api/index.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    },\n    \"api/users.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    },\n    \"api/books.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e2. How to route everything to index?\u003c/summary\u003e\n\n```json\n{\n  \"functions\": {\n    \"api/index.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  },\n  \"routes\": [\n    { \"src\": \"/(.*)\",  \"dest\": \"/api/index.php\" }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e3. How to update memory limit?\u003c/summary\u003e\n\nAdditional function properties are `memory`, `maxDuration`. Learn more about [functions](https://vercel.com/docs/configuration#project/functions).\n\n```json\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\",\n      \"memory\": 3008,\n      \"maxDuration\": 60\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e4. How to use it with \u003ca href=\"https://getcomposer.org/\"\u003eComposer\u003c/a\u003e?\u003c/summary\u003e\n\nYes, [Composer](https://getcomposer.org/) is fully supported.\n\n```sh\nproject\n├── api\n│   └── index.php\n├── composer.json\n└── vercel.json\n```\n\n```json\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  }\n}\n```\n\n```json\n{\n  \"require\": {\n    \"php\": \"^8.1\",\n    \"tracy/tracy\": \"^2.0\"\n  }\n}\n```\n\nIt's also good thing to create `.vercelignore` file and put `/vendor` folder to this file. It will not upload\n`/vendor` folder to Vercel platform.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e5. How to override \u003ca href=\"https://www.php.net/manual/en/ini.list.php\"\u003ephp.ini\u003c/a\u003e / \u003ca href=\"https://www.php.net/manual/en/configuration.file.php\"\u003ephp configuration\u003c/a\u003e ?\u003c/summary\u003e\n\nYes, you can override php configuration. Take a look at [default configuration](https://phpshow.vercel.app/) at first.\nCreate a new file `api/php.ini` and place there your configuration. Don't worry, this particulary file will be\nremoved during building phase on Vercel.\n\n```sh\nproject\n├── api\n│   ├── index.php\n│   └── php.ini\n└── vercel.json\n```\n\n```json\n{\n  \"functions\": {\n    \"api/*.php\": {\n      \"runtime\": \"vercel-php@0.7.3\"\n    }\n  }\n}\n```\n\n```json\n# Disable some functions\ndisable_functions = \"exec, system\"\n\n# Update memory limit\nmemory_limit=1024M\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e6. How to exclude some files or folders ?\u003c/summary\u003e\n\nRuntimes support excluding some files or folders, [take a look at doc](https://vercel.com/docs/configuration?query=excludeFiles#project/functions).\n\n```json\n{\n  \"functions\": {\n  \"api/**/*.php\": {\n    \"runtime\": \"vercel-php@0.7.3\",\n    \"excludeFiles\": \"{foo/**,bar/config/*.yaml}\",\n  }\n}\n```\n\nIf you want to exclude files before uploading them to Vercel, use `.vercelignore` file.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e7. How to call composer script(s) ?\u003c/summary\u003e\n\nCalling composer scripts during build phase on Vercel is supported via script named `vercel`. You can easilly call php, npm or node.\n\n```json\n{\n  \"require\": { ... },\n  \"require-dev\": { ... },\n  \"scripts\": {\n    \"vercel\": [\n      \"@php -v\",\n      \"npm -v\"\n    ]\n  }\n}\n```\n\nFiles created during `composer run vercel` script can be used (require/include) in your PHP lambdas, but can't be accessed from browser (like assets). If you still want to access them, create fake `assets.php` lambda and require them. [Example of PHP satis](https://github.com/juicyfx/vercel-examples/tree/master/php-satis).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e8. How to include some files of folders?\u003c/summary\u003e\n\nIf you are looking for [`config.includeFiles`](https://vercel.com/docs/configuration?query=includeFiles#project/functions) in runtime, unfortunately you can't include extra files.\nAll files in root folder are uploaded to Vercel, use `.vercelignore` to exclude them before upload.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e9. How to develop locally?\u003c/summary\u003e\n\nI think the best way at this moment is use [PHP Development Server](https://www.php.net/manual/en/features.commandline.webserver.php).\n\n```\nphp -S localhost:8000 api/index.php\n```\n\n\u003c/details\u003e\n\n## 👨🏻‍💻CHANGELOG\n\nShow me [CHANGELOG](./CHANGELOG.md)\n\n## 🧙Contribution\n\n1. Clone this repository.\n   - `git clone git@github.com:juicyfx/vercel-php.git`\n2. Install NPM dependencies\n   - `make install`\n3. Make your changes\n4. Run TypeScript compiler\n   - `make build`\n5. Run tests\n   - `make test`\n6. Create a PR\n\n## 📝 License\n\nCopyright © 2019 [f3l1x](https://github.com/f3l1x).\nThis project is [MIT](LICENSE) licensed.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel-community%2Fphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel-community%2Fphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel-community%2Fphp/lists"}