--- title: "Deploy a Laravel App" description: "Deploy a Laravel application on Miget with git push, FrankenPHP, and a managed database." --- Miget runs your Laravel app on a fixed-capacity plan with no per-service billing. Its PHP buildpack detects your app from `composer.json`, builds it with [FrankenPHP](/overview/buildpacks), and serves your `public/` directory on port 5000 - no web-server configuration required. ## Prerequisites Before you start, make sure you have: - A [Miget account](https://app.miget.com) - Git installed locally - you deploy by pushing to a Miget git remote - A Laravel app with a `composer.json` at its root - A local PHP toolchain - you need `php artisan` to generate your app key Every Miget app must listen on `0.0.0.0:5000`. Miget sets an immutable `PORT=5000` and only routes public traffic to that port. The PHP buildpack already serves your app on `5000`, so a standard Laravel app needs no changes. See [Ports](/networking/ports). ## Deploy your app In [app.miget.com](https://app.miget.com), click **New → Application**. Give it a name, pick the resource (plan) it should run in, and click **Next**. Select **Auto detection (Miget Buildpacks)** and choose an instance size, then click **Next**. Miget detects PHP from your `composer.json` and builds with FrankenPHP. See [Buildpacks](/overview/buildpacks). Choose **git push**, click **Create**, and copy the token shown. You'll use it to authenticate your push. Add the Miget remote and push: ```bash git remote add miget https://git..miget.io// git push miget ``` Replace ``, ``, and `` with the values from the dashboard. Miget builds and deploys on each push. See [Git push to builder](/deployments/git-push-to-builder). This guide uses git push, but it's one of several ways to deploy. You can also connect a [GitHub repository](/deployments/github-integration) for auto-deploys and pull request previews, deploy from a public Git repository, or push a prebuilt [container image](/deployments/container-registry) - see [all deployment methods](/deployments/how-it-works). Generate an app key locally, then set it (and the environment flags) as env vars on your app: ```bash php artisan key:generate --show ``` | Variable | Value | | --- | --- | | `APP_KEY` | The `base64:...` value from the command above | | `APP_ENV` | `production` | | `APP_DEBUG` | `false` | Store `APP_KEY` as a secret. See [Using secrets](/deployments/using-secrets). Never commit `APP_KEY` to your repository or set `APP_DEBUG=true` in production - it can leak configuration and stack traces. After a successful deploy, run your migrations as a post-deploy step: ```bash php artisan migrate --force ``` The `--force` flag is required because migrations run in a non-interactive production environment. ## Connect a database Add a **MySQL** or **PostgreSQL** addon to your app. Miget provisions it and auto-injects a `DATABASE_URL` env var (`mysql://...` or `postgres://...`). Laravel supports a `DATABASE_URL` connection string out of the box - `config/database.php` reads it via the `url` key - so you can point your connection at the injected value directly. Alternatively, map its parts to the individual Laravel variables: | Laravel variable | From `DATABASE_URL` | | --- | --- | | `DB_HOST` | host | | `DB_DATABASE` | path (database name) | | `DB_USERNAME` | user | | `DB_PASSWORD` | password | Once the database is connected, run `php artisan migrate --force` to create your tables. See [MySQL](/databases/mysql) and [PostgreSQL](/databases/postgresql). ## Next steps Point your own domain at your Laravel app. Keep `APP_KEY` and credentials out of your repo. Deploy automatically on every push to a branch. Learn how Miget shares CPU across your apps.