🚀 Introduction
- Before you begin, make sure you have PHP on your system. If you don’t have them yet, you can download them 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.
⚙️ Creating the squarecloud config file
Learn about: how to make 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 the name, description,
version, main file, among other things.
📄 Required Files
- index.php (Example of main file).
composer.json(*Optional dependency file).- squarecloud.app (a file containing your Square Cloud configuration).
▶️ Start Application
-
If the
STARTfield is not defined in the configuration file, a local PHP server will be started using thephp -S 0.0.0.0:80command. If theSTARTfield is defined in the configuration file, the value in theSTARTfield will be executed directly. For more information on configuration file parameters, visit configuration parameters. -
If the
composer.jsonfile exists, all dependencies will be installed using thephp composer.phar installcommand.
PHP with Swoole
- Swoole is a tool that enhances performance of the standard PHP, allowing the webserver serve multiple requests asynchronously.
- With this tools, you can create microservices, websockets, queue on background, etc. It allows you to execute events like in JavaScript.
- It’s also important to mention that Swoole has compatibility with other PHP frameworks. A good example of a PHP framework is Laravel, which is compatible with Swoole thanks to the Octane.
- You can use it instead of default PHP server by setting a custom START. Example:
- You can check out all the powerful features of Swoole here
🖥️ Preparing Project for Upload
Before you can host your project on Square Cloud, ensure your project files are correctly 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 file), you should specify the installation process in the START field of your squarecloud.app file. For example:
The configuration (
squarecloud.app/.config) file must be located in the root of the zip file. Otherwise, Square Cloud will not be able to find it during deployment.📤 Uploading Project to Square Cloud
After preparing your project files, you can now upload them to Square Cloud and host your project.- Dashboard Upload
- CLI Upload
Access the Square Cloud
Dashboard and upload your project
files.


