Configuration for Vercel
api/index.php
<?phprequire __DIR__ . '/../public/index.php';
Vercel only allows an app’s entry-point to live inside the API directory, so we have to set up a simple script to forward to Laravel’s normal public/index.php
entry-point.
.vercelignore
/vendor
This will make sure we don’t upload the entirety of our vendor directory to Vercel when we deploy (We’ll set up Vercel to automatically install composer dependencies).
vercel.json
{ "version": 2, "framework": null, "functions": { "api/index.php": { "runtime": "vercel-php@0.6.0" } }, "routes": [{ "src": "/(.*)", "dest": "/api/index.php" }], "env": { "APP_ENV": "production", "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" }}