Skip to content
For agents
Browse guides

PHP and Laravel

Serve a PHP app with Composer dependencies or deploy the Laravel starter.

Open Markdown

Deploy a Laravel or other PHP app from source. Smolcloud installs your Composer packages and serves the app with FrankenPHP. The Laravel starter uses Apache instead, through its own Dockerfile.

Start from the Laravel template

Shell
smolcloud init laravel ./my-app

This creates a small working app with a Dockerfile. You can use your own project instead. Either way, create an app first to get its ID.

The Laravel starter listens on port 3000 and has a health route at /api/health. It starts without sessions. Before you add sign-in, sessions or encryption, set APP_KEY as an environment variable in Configuration and keep the same value across deployments.

The app can't write to its own folders once deployed. Point Laravel's cache, sessions and logs at a temporary folder, a database or an approved disk.

Deploy source

Include composer.json and composer.lock. Public packages are downloaded from Packagist. If the app also builds JavaScript or CSS, include package-lock.json (or your tool's lockfile) too.

Create the app to get its ID, then deploy the source folder:

Shell
smolcloud deploy APP_ID ./my-app

If the folder has a Dockerfile, Smolcloud uses it. The starter includes one; delete it if you'd rather Smolcloud work out the build itself. Automatic builds lists what a build can download and where to see the commands it chose.

Set the port and health path in the app's Configuration. deploy waits until the app is live and prints its address. Open it and try a real page, not only the health path. If you need a private package registry, build an image in your own CI and deploy that.

Limits

  • The app runs as user 10001:10001, not root, and can't write to its own filesystem.
  • Builds can't reach private package registries or other download sites.
  • Keep data in PostgreSQL, a bucket or a disk; anything else is lost on the next deploy.