One Framework a Day keeps the Boredom Away: Laravel

1fdba laravel 1

Welcome to this new edition of One Framework a Day keeps the Boredom Away. In this series I will show you how to deploy a particular framework on Clever Cloud every day until I want to go back to boredom. Today it's about Laravel.

In each post of this series we'll see how to deploy a particular framework on Clever Cloud. Today we are taking a look at Laravel.

If you want to tag along, make sure you have git, a Clever Cloud account and that you have installed our CLI Clever-Tools.

What is Laravel?

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.

To go a bit further the basics, I have deployed this URL shortener application called Polr. It's actualy written with Lumen, a Laravel micro-framework.

Setup

Here are the necessary steps to configure your Polr application:

  • Clone the backend: git clone https://github.com/cydrobolt/polr
  • Get in the project: cd polr
  • Create the PHP application: clever create --type php polr
  • Create the MySQL addon: clever addon create mysql-addon --plan dev polr-mysql
  • Link the database to the application: clever service link-addon polr-mysql
  • Add your domain: clever domain add mypolr.cleverapps.io
  • Copy the default configuration: cp .env.setup .env

Then you need to setup the default webroot. We don't support environment variable for this yet, so you will have to create a php.json file under a clevercloud directory:

mkdir clevercloud vim clevercloud/php.json

{
  "deploy": {
    "webroot": "/public"
  }
}

Now commit all your changes, run clever deploy than clever open. You will be taken straight to the setup wizard of Polr. Go through all the steps, yes even the database configuration, because the setup will write ot the DB at the end. It will also overwrite .env. Problem is we use immutable infrastructure so all the changes written on that file will be lost at reboot. And reboot can happen for many reasons. Best way to manage this is to use clever ssh to log on the machine and copy the content of the now changed .env file to your own version of the file.

All the fields in this file can be remove and replaced by environment variables. You can also use pre-existing variables. In my case I have configured the database part like this:

DB_HOST=$MYSQL_ADDON_HOST
DB_PORT=$MYSQL_ADDON_PORT
DB_DATABASE=$MYSQL_ADDON_DB
DB_USERNAME=$MYSQL_ADDON_USER
DB_PASSWORD=$MYSQL_ADDON_PASSWORD

Feel free to remove any fields you want to setup as an environment variable as they will be picked up automatically too.

The other option you have would have been to know exactly all the configuration variables needed, set them all, than ssh on the machine and use the artisan CLI to seed the database. Which is to me more cumbersome.

Whatever solution you choose, take a look at their installation guide. This will give you a good idea of all the things that are managed automatically by Clever Cloud 🙂

Blog

À lire également

Cloud modernisation: how to align governance and operations without adding complexity

European organisations are managing increasingly heterogeneous environments: legacy applications, cloud-native services, multi-cloud setups and regulatory constraints are accumulating within information systems rarely designed to handle such diversity.
Engineering Event Guests

Clever Cloud launches Clever Kubernetes Engine (CKE) in public beta on April 27, 2026

Previewed at Devoxx starting April 22, CKE is the culmination of two years of R&D built around a complete reimplementation of Kubernetes.
Company Engineering Press

The DEEP, OVHcloud and Clever Cloud consortium selected to deliver sovereign cloud services for European institutions

Paris – April 17, 2026 – The consortium composed of DEEP by POST Luxembourg Group, OVHcloud and Clever Cloud today announces its selection by the European Commission as part of a major procurement framework to provide sovereign cloud services to the institutions, bodies and agencies of the European Union. This contract, with a ceiling of €180 million over six years, marks a significant milestone in the concrete implementation of Europe’s digital sovereignty strategy.
Company