Before you begin
- PHP on your machine. If you don’t have it, download it from the official PHP website.
- A Square Cloud account: sign up with your email or GitHub.
- An active plan. See the plans and pick the one that fits your project.
Configure Square Cloud
If you upload your application through the dashboard, you can skip this section: the dashboard creates the
squarecloud.app configuration file for you.Configuration file reference
The
squarecloud.app file tells Square Cloud how to run your application: its main file, memory, runtime version, name and, for a website, its subdomain.squarecloud.app
What Square Cloud runs
-
If the
STARTfield is not defined in the configuration file, a local PHP server will be started with the commandphp -S 0.0.0.0:80, with the root of your ZIP as the document root. If theSTARTfield is defined, the value in it will be executed directly. For more information about configuration file parameters, visit configuration parameters. -
If your project has a
composer.jsonat its root, Square Cloud runscomposer installbefore every start, so you don’t need it inSTART. It uses thecomposer.pharfrom your ZIP when there is one, and the Composer included in the runtime otherwise. Uploadcomposer.locktoo, so the server installs the same versions you tested.
Port and host
The default command already listens on port 80 and all network interfaces (0.0.0.0). When you write your own START, keep both: Square Cloud sets the PORT environment variable to 80, and a server that listens only on 127.0.0.1 never receives requests.
PHP with Swoole
- Swoole is a tool that improves standard PHP performance enabling the webserver to handle multiple requests asynchronously.
- With this tool, you can create microservices, websockets, background queues, among others. It also allows you to execute events just like JavaScript does.
- It is also important to mention that Swoole is compatible with other PHP frameworks. A good example of a PHP framework is Laravel which is compatible with Swoole thanks to Octane.
- You can use it instead of the standard PHP server by defining your custom START command. Example:
- You can check out all the powerful functions of Swoole in the Swoole manual.
Prepare the project
Required files
squarecloud.app, at the root of the ZIP.index.php, or the file set inMAIN.composer.jsonandcomposer.lock, when you use Composer packages.
composer.json on its own. If your project also has Node dependencies (a package.json) to build assets, install and build them in START. For example:
squarecloud.app
What to leave out
- Your local
.envfile: set your secrets as environment variables instead. The default server uses the root of the ZIP as the document root, so any file you upload there can be downloaded. vendor/: Square Cloud installs it fromcomposer.json.node_modules/, when yourSTARTcommand installs it.
Framework guides
Laravel
Deploy
Via dashboard
1
Access the Upload Page
Access the upload page and upload your project zip file.
2
Configure Your Environment
After uploading your zip, you will need to configure the name, main file or runtime environment and other settings for your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
3
Deploy Your Project
Finally, click on the “Deploy” button to host your project on Square Cloud.
After deployment, you can monitor your project’s status and logs from the dashboard.
After deployment, you can monitor your project’s status and logs from the dashboard.

4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. In the dashboard, wait for your application status to show as running and check the logs for any startup errors.
If you deployed a website or API, open
If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Via CLI
To use this method, your project needs a configuration file namedsquarecloud.app at its root. It tells Square Cloud how to run your application.
Configuration file guide
Learn how to create the
squarecloud.app configuration file that defines your application’s environment.1
Install the CLI
Install the Square Cloud CLI. If you already have it, run the same command to update it:
2
Log In
Run the command below. It opens your browser: approve the login there and the CLI is ready. There is no API key to copy. For scripts and CI, see CLI authentication.
3
Upload Your Project
From your project folder, run the command below. The CLI zips the current folder, leaving out what To upload a zip you created yourself, pass it with
squarecloud.ignore lists, and uploads it:--file:4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. Check your application status and logs directly from the terminal:If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Next steps
Environment variables
Keep secrets and settings out of your code and read them at runtime.
Custom domain
Serve your app on your own domain, on the Standard plan and above.
Troubleshooting
Fix an app that does not start or a site that does not respond.

