Follow these steps
- create a folder called api
- Inside the folder, create a file called index.php
- In the index.php file write the following.
<?php require __DIR__ . '/../public/index.php';
In the root directory, create a file called .vercelignore.
In the file created, write the following:
/vendor
Create an empty folder named dist
Create a file called vercel.json
In the file created write the following
{
{"version": 2,
"framework": "null",
"functions":{
"api/index.php": { "runtime": "[email protected]"}
},
"routes": [
{
"src": "/(.*)",
"dest": "/api/index.php"
}
],
"env": {
"APP_ENV": "production",
"APP_DEBUG": "true",
"APP_URL": "https://akos-portfolio.vercel.app",
"APP_CONFIG_CACHE": "/tmp/config.php",
"APP_EVENTS_CACHE": "/tmp/events.php",
"APP_PACKAGES_CACHE": "/tmp/packages.php",
"APP_ROUTES_CACHE": "/tmp/routes.php",
"APP_SERVICES_CACHE": "/tmp/services.php",
"VIEW_COMPILED_PATH": "/tmp",
"CACHE_DRIVER": "array",
"LOG_CHANNEL": "stderr",
"SESSION_DRIVER": "cookie"
}}
}
You can now upload your file to vercel.
watch https://www.youtube.com/watch?v=dERa0R2zLqc&t=103s . to understand how it can be done