π Introduction
- Before getting started, ensure that PHP is installed on your system. If you donβt have it yet, you can download it from the official PHP website.
- Next, you will need to create an account on Square Cloud, which can be done through the login page. You can use your email, GitHub, or both to create the account.
- Finally, you need to have an active paid plan on your account. You can view our plans and purchase one according to your needs here.
βοΈ squarecloud.app file configuration
Learn more: how to create the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to
configure your application; it will serve to define the name, description,
version, main file, among other things.
If you are uploading your application via the Square Cloud website, you can ignore this section. The site automatically creates the
squarecloud.app configuration file for you.π Required Files
- index.php (Example of main file).
composer.json(Dependencies file optional).- squarecloud.app (file containing Square Cloud configuration).
βΆοΈ How to start your application
-
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. If theSTARTfield is defined, the value in it will be executed directly. For more information about configuration file parameters, visit configuration parameters. -
If the
composer.jsonfile exists, all dependencies will be installed using the commandphp composer.phar install.
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 here.
π₯οΈ Preparing the project
Before hosting your project on Square Cloud, first check if the project files are properly configured for hosting. If your project includes acomposer.json file, Square Cloud will automatically install dependencies using Composer. However, if your project also has Node dependencies (i.e., a package.json), you must specify the installation process in the START field of your squarecloud.app file. For example:
π€ How to host your project
Now that you have prepared all the files for your PHP project, the next step is to upload them to Square Cloud and put your application online. There are several ways to upload, but we will cover two: via Dashboard or via CLI.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.

Via CLI
To use this method, you need to create a config file namedsquarecloud.app in the root directory of your project. This file will contain the necessary configuration for your project.
Learn more about: how to create the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to configure your application; it will be used to define your environment.
1
Install the CLI
First, you need to have the CLI installed in your environment. If you don't have it yet, run the following command in your terminal:If you already have it, we recommend updating it. To do this, run the following command in your terminal:
- Windows
- Linux, macOS, and WSL
2
Authenticate
Now, to authenticate and use other CLI commands, you will find your authorization key here by clicking on "Request API Key". After obtaining your authorization key, run the following command:
3
Upload Your Project
Finally, to deploy your application to Square Cloud using the CLI, you need to run the following command:Or if you created the zip manually, you can use:

