Skip to content

treckstar/vercel-laravel-10-starter

Repository files navigation

Vercel Laravel 10 Starter (PHP 8.3)

Credit

🏋️‍♀️ It works with these frameworks and tools. Discover more at examples.

Made with ❤️ by @f3l1x (f3l1x.io) • 🐦 @xf3l1x

Majority of updates taken from pull request by @cmizzi

Important Files

This repository inherits from Laravel 10.x. Important files are the following ones:

💯 Versions

Change the version of vercel-php dependency in .vercel.json for the version you want to use.

Build assets

Add the following snippet in the composer.json file.

{
    "scripts": {
        "vercel": [
            "npm install",
            "npm run build"
        ]
    }
}

Enable HTTPS

See app/Http/Middleware/TrustProxies.php.

-   protected $proxies = null;
+   protected $proxies = "*";   

Common

You still need to setup the basics, such as making an .env file, setting an APP_KEY, etc.

Do not save your APP_KEY in the .vercel.json file. You must set this in the settings.

Create .env file

cp .env.example .env

Create dist folder

If you do not want to change the build output folder settings, run this:

mkdir dist
echo "# for vercel output" >> dist/.gitkeep

There is a chance that your local .dotfiles have the dist folder in a .gitignore file, so force add it:

git add dist -f
git commit -m "chore: dist folder for vercel output"
git push