Create a Laravel application using a low-code approach

Using Laraboot CLI

Oscar Nevarez
3 min readSep 29, 2021

What is Laraboot?

Laraboot is a CLI tool that allows Laravel developers to bootstrap and configure a Laravel application using cloud-native technologies which make your developer experience a lot more enjoyable.

Install Laraboot CLI

npm i -g @laraboot-io/cli

Setup our project

Create a new project

Similar to the Laravel installer you can run laraboot new to initialize a Laravel application.

laraboot new app --php-version=8.0

Build

We’re ready to build the application. In this step, Laraboot will use the source code and will transform it using build tasks to finally create an OCI image. Please mind the process might take a while especially if this is the first time you run the build command.

laraboot build

Run

Once built, the project is ready to be used.

laraboot run --port=900

Boom! we have our application running. Head to http://localhost:9000 and you’ll see a familiar welcome page.

That’s really interesting, right? Well, quiet but it’s not very different from a traditional setup. Laraboot shine because of its extensibility.

Configure

Add core tasks

Core tasks allow Laraboot to configure your Laravel application without writing any code.

Tip: you can run laraboot task search * --core-only to discover all the available core tasks.

We are going to use two of those tasks for this occasion modeland foundation

laraboot task add @core/laravel-model --format=file
laraboot task add @core/laravel-foundation-provider --format=file

What’s with @core/laravel-foundation-provideryou say? Currently is required as a base for any other core tasks, it is expected to be included by default in future versions but, for now, we need to add it manually.

See the — formatflag? We’re indicating the desired format for our task. A build task can be consumed as an OCI image or Zipped file. This comes in handy now that Docker limits the pull rate on authenticated requests.

Setting up our data model

Let’s create some entities aka models to flesh this app out.

laraboot model add Post
√ Would you like to define your model now? (y/N) · true
√ Field name? · content
√ Field type? · varchar
√ Is this field unique? (y/N) · false
√ Is this field primary key? (y/N) · false
√ Would you like to add a new field? (y/N) · false
Model Post was added
laraboot model add Comment
√ Would you like to define your model now? (y/N) · true
√ Field name? · content
√ Field type? · varchar
√ Is this field unique? (y/N) · false
√ Is this field primary key? (y/N) · false
√ Would you like to add a new field? (y/N) · false
Model Comment was added

Build again

Previously we had built this application but there wasn’t much in it. Now with our data model defined and model task added to our project things will be different.

laraboot build

And just like that, we had created all the models, routes, and controllers to support our application based on the data model.

Conclusion

On this occasion, we use Laraboot cli to set up a new Laravel application without having to write any line of code. This application has been containerized and it’s ready to be used on your favorite cloud provider.

--

--

Oscar Nevarez

Dad, Polymath , Passionate about technology, AI Advocate, Human.