Skip to main content

Professional Laravel Application Development

  • Before starting, make sure you have PHP (>= 8.x) and Composer installed on your system. If you don’t have them yet, you can download them from the official websites, PHP and Composer.
  • Next, you’ll need to create an account on Square Cloud, which can be done through the signup page.
  • Finally, you need to have an active paid plan on your account. You can view and purchase a plan according to your needs here.

Laravel Installation

To use Laravel, install it globally using Composer with the following command:
composer global require laravel/installer
After installation, you can create a new Laravel project with:
laravel new myapp

Creating a Laravel Project

After creating the project, navigate to the folder and start the development server:
cd myapp
php artisan serve
This will start a local server, usually on http://localhost:8000.

Basic Route Example

Here is a basic example of a route in routes/web.php:
<?php

use Illuminate\\Support\\Facades\\Route;

Route::get('/', function () {
    return 'Hello World from Laravel!';
});

Creating the Square Cloud Configuration File

Learn more about: how to create the configuration file for Square Cloud.

The squarecloud.app file is a configuration file used to define your application’s name, description, version, main file, and other essential settings.

Configuring the START Field

In the Square Cloud configuration file, the START field is optional and only necessary if your application requires a custom command to start. We already have Swoole installed in the environment if you want to serve it with Swoole webserver. Check here

Purchasing a Plan Before Uploading the Project

Before uploading your project to Square Cloud, make sure you have an active plan with enough resources. Laravel applications typically run well on the Standard plan (4GB RAM, 4vCPU), but more complex projects may benefit from the Pro plan.
Not sure how much RAM and CPU you need for Laravel? Laravel is a full-featured backend framework that may require more resources depending on the size of your application. Our Standard plan is suitable for most projects. To purchase a plan, click the appropriate link in the pricing page.

Uploading the Project to Square Cloud

After preparing your project, you can upload it to Square Cloud using the dashboard or the CLI.
  • Upload via Dashboard
  • Upload via CLI
Access the Square Cloud Dashboard and upload your project files.

Additional Resources

For more information about Laravel, visit the official documentation available here. It provides detailed guides, examples, and API references to help you build powerful applications.

Troubleshooting

Custom Domain

To use a custom domain (e.g., mysite.com) instead of the default URL https://mysite.squareweb.app/, you need the Standard plan or higher. The subdomain is defined by the SUBDOMAIN field in the configuration file. See: How to set up your custom domain.

Minimum RAM Requirements

Minimum: 512MB RAM for simple websites/APIs. For sites with frameworks (Next.JS, React, Vue, Angular, etc.), we always recommend at least 1GB RAM. For larger applications, use more RAM to avoid LACK_OF_RAM error and ensure performance.

Could not find this site.

Check if the subdomain/domain matches what's configured in the SUBDOMAIN field or in the custom domain settings. If you just uploaded the site, wait up to 60 seconds for Square to enable first access.

Site took too long to respond...

Check if you correctly configured port 80 and host 0.0.0.0 in the application. We recommend using Square's forced environment variables: PORT and HOST from the .env file.
If you continue facing technical difficulties, our specialized support team is available to assist you. Contact us and we'll be happy to help you resolve any issue.