Backend Development 6 min read

Getting Started with Laravel 11: Creating a Sample Application and Setting Up ServBay on macOS

This tutorial walks through installing Laravel 11, creating a sample Laravel project, launching its development server, and configuring the ServBay tool on macOS to manage PHP, databases, and hosts for smooth local backend development.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Getting Started with Laravel 11: Creating a Sample Application and Setting Up ServBay on macOS

Laravel 11 has been officially released, bringing many notable improvements.

The new version introduces a more streamlined application architecture, allowing developers to build and maintain applications more efficiently. It also adds per‑second rate‑limiting, enhancing robustness and security, and a health‑check routing mechanism for easier monitoring of application health.

Excitingly, Laravel 11 includes the first‑party, extensible WebSocket server Laravel Reverb, giving developers powerful tools for building real‑time applications with smooth interactive experiences.

In this guide, I will show you how to set up a sample Laravel application and install ServBay for local development on macOS. ServBay provides an all‑in‑one solution on Mac, integrating a web server, databases, programming languages, mail server, and queue services, greatly simplifying the development workflow.

Create Sample Application

Now, let’s start using composer to generate a Laravel sample application. Follow these steps:

1. Open a terminal or command‑line interface.

2. Run the following command to create a new Laravel project named example-app :

composer create-project laravel/laravel example-app

After executing this command, composer will download the latest stable Laravel version and install it into a new directory called example-app .

3. Change into the newly created project directory:

cd example-app

This moves you to the project’s root, where you can begin configuring and running your Laravel application.

4. Start Laravel’s development server with the following command:

php artisan serve

The artisan CLI tool provides many useful commands; here the serve command launches a lightweight development web server.

5. Open your browser and navigate to http://127.0.0.1:8000 . You should see Laravel’s default welcome page, confirming that the application is set up and running.

Install ServBay Server Rack

To more effectively manage a local PHP development environment on macOS, we will use the powerful ServBay tool. ServBay integrates multiple versions of PHP, Node, MariaDB, PostgreSQL, and also allows easy installation of Redis and Memcached.

Installation steps for ServBay:

Visit the official ServBay website.

Download the latest version of the installer.

Open the downloaded installer and drag the ServBay.app file into the Applications folder.

After installing ServBay, open ServBay.app and follow the initialization prompts.

Add New Host

Once ServBay is installed, you can easily add a new host for your sample Laravel application:

Navigate to the “Hosts” tab and click the plus button to open the “Add Host” form.

Configure the host as follows:

Enter “Laravel 11 Demo” in the “Name” field.

Enter “lara.host” in the “Domain” field.

Set the “Root Directory” to the path of your Laravel app’s public folder, typically example-app .

Click the “Add” button, then visit lara.host in your browser to see the default welcome page of the example app.

From now on, you can use the ServBay platform to enjoy a smooth Laravel local development experience on macOS.

BackendWeb DevelopmentPHPmacOSLaravelServBay
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.