Setting Up the Local Development Environment for Laravel
Master your Laravel environment setup by installing PHP, Composer, and SQLite. Get your terminal configured to start building our Task Manager application.
Welcome to the "Laravel Fundamentals: From Zero to Your First App" course. This is where we lay the foundation for everything we’ll build. Before we can write a single line of application code, we need to ensure your machine is a capable "Laravel factory."
In this lesson, we will install PHP, Composer, and SQLite, and configure your terminal environment. These tools are the bedrock of modern PHP development, and getting them right now prevents hours of frustration later.
Understanding the PHP Ecosystem
Laravel is built on top of PHP, a server-side scripting language designed for web development. Unlike languages that require complex compilation, PHP is interpreted, making it incredibly fast for iterative development.
To manage the libraries and packages that make Laravel powerful, we use Composer. Think of Composer as the "App Store" for PHP code. It downloads the framework, handles dependencies, and ensures your project has exactly what it needs to run. Finally, for our database, we will use SQLite. As discussed in SQLite for Local-First Web Applications: A Practical Guide, it is a file-based database engine that requires no server configuration, making it the perfect choice for our local Task Manager project.
Installing the Essentials

1. Installing PHP
You need PHP 8.2 or higher to run current Laravel versions.
- macOS: Use Homebrew by running
brew install php. - Windows: Download the "Thread Safe" zip file from windows.php.net and add the folder path to your System Environment Variables.
- Linux (Ubuntu/Debian): Use
sudo apt install php php-cli php-mbstring php-xml php-curl.
Verify your installation by running:
Bashphp -v
You should see output confirming your version is at least 8.2.0.
2. Installing Composer
Composer is the standard dependency manager for PHP. Download the installer from getcomposer.org.
Once installed, you should be able to run composer from anywhere in your terminal. Verify it with:
Bashcomposer --version
3. Verifying SQLite
Most modern PHP installations come with the SQLite extension enabled by default. To check if it's available, run:
Bashphp -m | grep sqlite
If you see pdo_sqlite in the list, you are ready to go. If not, ensure the extension is uncommented in your php.ini file.
Configuring Your Terminal Environment
To work efficiently, your terminal needs to "find" these programs. If you type php and get a "command not found" error, your system's PATH variable is misconfigured.
- macOS/Linux: Edit your
~/.zshrcor~/.bashrcfile and ensure the directory containing your binaries is in your PATH export. - Windows: Ensure the directory where you extracted PHP is in your System Path variable.
Hands-on Exercise
Let's confirm your setup is "Laravel-ready." Open your terminal and run the following command to check if you can reach the PHP binary:
Bash# This should print the current PHP version again php -r "echo PHP_VERSION;"
Next, try to create a dummy directory and run a Composer command:
Bashmkdir test-env && cd test-env composer init --no-interaction
If this creates a composer.json file without errors, your terminal environment is correctly configured.
Common Pitfalls
- Multiple PHP Versions: If you have multiple versions of PHP installed (e.g., one from Homebrew and one system default), your terminal might be looking at the wrong one. Always check
which phpto see the path of the binary being executed. - Missing Extensions: Laravel requires specific PHP extensions (like
bcmath,ctype,fileinfo,mbstring,pdo, andxml). If you run into "missing extension" errors later, don't panic—it just means you need to install that specific module via your package manager. - PATH Confusion: If you install Composer but your terminal says "command not found," restart your terminal application. It needs to reload the shell configuration to recognize the new path.
Recap
We’ve successfully installed the core toolkit for our Laravel development:
- PHP: The engine that runs our code.
- Composer: The tool that manages our framework and libraries.
- SQLite: Our lightweight, file-based database for the Task Manager.
- Terminal: Properly configured to execute these tools globally.
With these pieces in place, your local environment is now prepared for the next step: bringing in the framework itself.
Up next: Installing Laravel and Exploring Directory Structure.
Work with me

Laravel REST API Development
Clean, secure, well-documented Laravel REST APIs — the backend engine for your app, mobile client, or SaaS. Built by an API specialist.

FilamentPHP Admin Panel & Dashboard Development
A powerful admin panel for your Laravel app — built with FilamentPHP so you can manage everything without touching the database.