Laravel is an open-source framework for building scalable PHP web apps. It’s a favorite among many developers due to its easy-to-use modules for authentication, dependency management, session and cache storage, routing, and more.

Laravel Forge simplifies deploying and configuring Laravel applications by automating server provisioning, software installation and maintenance, and deployment. It also has advanced security features such as firewalls and Secure Socket Shell (SSH) authentications.

This article will walk you through how Laravel Forge works, its main features and deployment options, and how it compares with Kinsta.

How and Why You Should Use Laravel Forge

Laravel Forge acts as your server manager, allowing you to install PHP, Nginx servers, MySQL databases, and any other dependencies without installing them manually. This helps ship code much faster by making cloud server changes easy.

Other uses include:

  • Managing background processes (daemon)
  • Executing applications using bash scripts
  • Secure Socket Layer (SSL) certificate installation
  • Scheduling cron tasks

How Does Laravel Forge Work?

Laravel Forge’s efficient new design prioritizes simplicity and ease of use. It allows you to choose a hosting provider, such as Digital Ocean, Linode, or Rackspace, which provides you with a server in minutes.

Each server holds a complete stack of the latest versions of PHP, Nginx, MySQL, PostgreSQL, and caching libraries like Redis. Once created, the server lets you link your application to your versioning tools, such as GitHub, GitLab, or Bitbucket.

Laravel Forge adds a deployment script to your application that can run on the servers with a single click. This provides added flexibility and efficiency when deploying vanilla PHP and Laravel applications. Laravel Forge can also manage applications in other tech stacks, such as Node.js.

During deployment, Laravel Forge uses SSH keys to log into your servers, running and installing all the latest software dependencies your application needs. This makes it easier to change hosting providers at any time to counter scalability or to increase or reduce servers depending on demand.

Other deployment options for Laravel Forge include:

  • Deployment Scripts — These are used to execute server commands. This deployment option can be edited using the Forge UI.
  • Deployment from Continuous Integration (CI) tool — Users can choose either Forge CLI or Deployment Trigger to deploy their applications with Forge.

How To Deploy with Laravel Forge

To deploy an app using Forge, create an account with them, then choose from one of the many available server host providers. Once you have provisioned your server with the right location and droplet plan, create a domain name. Forge automatically creates all the necessary dependencies and libraries by installing the latest PHP versions on your server.

Note: You will need an API key to connect to a cloud provider not provided in Laravel Forge.

Next, authenticate to the version control of your choice. This makes it easy to migrate the repository codebase to Laravel Forge. Developers can then collaboratively contribute to the repository and have the changes auto-deployed to the server.

After linking your repository, click Deploy Now to enable the Forge software to execute the deploy script and set up the application.

One way to deploy your application using Laravel Forge is by using a CI tool. Once Forge CLI is installed, you can use the deploy command in your CI environment. You will need the Forge API token to authenticate to the Forge CLI.

The example below will illustrate how to do this in a few easy steps while using GitHub. In your project directory, create a your-project/.github/workflows directory. Within it, create a forge.yml file with the content below:

name: Deploy

    branches: [ main ]

    runs-on: ubuntu-latest
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup SSH
        uses: webfactory/[email protected]
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
          php-version: 8.0
          tools: composer:v2
          coverage: none
      - name: Require Forge CLI
        run: composer global require laravel/forge-cli
      - name: Deploy Site
        run: |
          forge server:switch your-server-name
          forge deploy
          FORGE_API_TOKEN: ${{ secrets.FORGE_API_TOKEN }}

Note: You can review the example code here. You can then push the changes to your main branch and let GitHub Actions execute the deployment scripts.

Environment variables such as database passwords and secret keys can be challenging to keep in a production environment. To keep your project files secure, configure the database and application environment variables to each of your project’s environment (.env) files.

Benefits of Laravel Forge

User benefits for Laravel Forge include:

  • Not restricting users to one hosting platform. This makes deploying many projects on disparate hosting providers easy, depending on their needs.
  • Using the deployment script to automatically run the requirements of your application with the latest libraries without installing them manually.
  • Consistency in configuration settings and permissions and reducing deployment costs and errors. This allows developers to focus more on application development than maintaining deployment scripts and processes.
  • Advanced and innate security to your application’s server through a firewall, SSH keys, and data isolation to prevent leaks.

Laravel Forge and Kinsta

While Laravel Forge is responsible for managing application servers, Kinsta is a hosting management platform that allows you to take your application and database hosting demands to the next level. If you have a WordPress site managed by Forge software, it’s easy to migrate to Kinsta for free.

Kinsta offers several advantages for its users, such as better admin tasks optimization tools, DevOps support for application hosting, and Cloudflare features for WordPress hosting.

Kinsta provides all this with enterprise tools and premium features with no hidden or extra cost for each plan.


Deployment can be challenging for organizations large and small. Each application has its challenges, such as scalability issues, redundant dependencies, and process complexity.

Laravel Forge makes hosting applications efficient and hassle-free by acting as a broker between developers and servers. Using various deployment options, developers can choose either deployment scripts or the CI tool to manage their sites and servers.

Like with Laravel Forge, deploying web apps with Kinsta is a breeze, but you also get greater flexibility, features, and pricing plans. Start your free trial today!