Run CodeIgniter 4 apps locally with the free Laravel Herd, MySQL Community Server and Sequel Ace, plus the folder naming rule Herd insists on.
published on 5 Jan 2026 in PHPWeb DevelopmentCodeIgniterEvery couple of years I used to lose a morning to my local PHP stack. MAMP Pro would refuse to start, or two tools would fight over port 80, or a PHP upgrade would quietly break every virtual host on the machine. Since I moved my CodeIgniter work to Laravel Herd, that morning has not happened once.
Herd is built by the Laravel team, but there is no longer anything Laravel-specific about how it serves sites. Point it at a folder and anything with a public/index.php answers on a friendly .test domain. That includes CodeIgniter 4 projects, and it includes projects generated with CodeIgniter Wizard, the scaffolding and bootstrapping tool (currently Mac-only) to generate an advanced starting point for CodeIgniter web apps with a head start.
Below is the exact setup I use every day: Herd for serving, MySQL Community Server for the database, and Sequel Ace to manage it. All three are free.
Before anything else, one warning. It accounts for most of the Herd-related support mail I receive:
The Herd folder name rule
When CodeIgniter Wizard creates a project, its folder name must contain no delimiters. No spaces, no underscores, no hyphens. Lowercase letters and digits only.
The folder name becomes the local hostname, and it also feeds the identifiers in the generated code. A project called Customer Order Fulfillment belongs in a folder like customerorderfulfillment, or simply customerorders if you prefer typing less. Parked correctly, it answers at http://customerorderfulfillment.test (or https:// once you enable SSL).
Database setup
The free tier of Herd does not bundle MySQL. I consider that a feature. Installing MySQL yourself keeps the database independent of your web stack, and a lightweight client does the rest.
1. Install MySQL Community Server
If you are already sold and have Herd Pro, skip this step. Otherwise grab MySQL from dev.mysql.com/downloads/mysql. Remember the root password you set during installation; you will need it in a minute.
2. Install Laravel Herd
Download it from herd.laravel.com and run the installer. When it finishes you should see the Herd icon in your macOS menu bar (or the system tray on Windows).
3. Install Sequel Ace
Sequel Ace is the GUI client for MySQL I keep open all day: fast, native, and free. Get it from the Mac App Store or from sequel-ace.com.
4. Create a database for the app
Connect with host 127.0.0.1, port 3306, username root, and the password from step 6. Then create a database named after your project, for example example.
5. (Optional if you have CodeIgniter WIzard) Make sure your terminal uses Herd's PHP and Composer
which php
which composer
Both paths should contain Herd. If they point somewhere else, another installation is shadowing it. On my machine the culprit was a leftover Homebrew PHP; yours will usually be the same.
6. Park your project folder on a Herd path
Herd serves every site it finds inside its configured Herd Paths (also called parked folders). Click the Herd icon, open Settings, and look under General for the list. Most installs start with a default of ~/Herd. Anything you drop in there gets a domain of foldername.test, no configuration required.mkdir ~/Code
7. Define the connection parameters in CodeIgniter Wizard
Open CodeIgniter Wizard and edit the Database Connection Definitions. Define the connection with the host, port, username, password and database name from the previous step. The Wizard will be writing these into the generated app's configuration for you.
8. Create the CodeIgniter project, the safe way
With CodeIgniter Wizard: create the project inside your Herd path (in my case it is in/at /Users/demo/Code/myMLtraining/) and obey the folder rule above.
That is the way.
If you do not have CodeIgniter Wizard, use Composer for a fresh manual install:
cd ~/Herd #or cd ~/Code # which I created earlier
composer create-project codeigniter4/appstarter example
This produces a folder named example, which Herd picks up on its own.
8. Open Herd's Sites list and load the app
Click the Herd icon, then Sites. Your project should be listed; if not, hit Refresh. Open http://example.test in the browser and the CodeIgniter welcome page should greet you.
9. Verify your web app's base URL
If you forgot to change the app's base URL from http://localhost:8080 to the URL what Herd will provide (typically http://<appFolderName>.test) as soon as it is created in the paths we reviewed and/or edited earlier, time to do it now.
If you are not a CodeIgniter WIzard user, then edit the .env file and specify the base URL there like so:
app.baseURL = 'http://myMLtraining.test'
10. Test the app in CLI / Terminal
php spark
Run that inside the project folder. If it completes without complaint, the app is talking to MySQL and you are done.
11. Test the URL in a browser
Herd > Settings > Sites > Your web app gives links to both the web app's folder in the file system and it's base URL which opens it directly in the browser (just like CodeIgniter WIzard does).
What you get after the first time
Do this once and it becomes the default workflow: predictable PHP versions, clean domains, no port juggling. New project, new folder, done.
If you take away one thing, take the folder rule. Delimiter-free folder names are non-negotiable for Herd. A Wizard project folder with underscores, hyphens or spaces in it will misbehave, and the failure will not tell you why.
TechNewbie
Wow, this is so cool! I didn't know you could use Laravel Herd for CodeIgniter projects. The folder name rule makes sense now. No spaces or hyphens in the root folder name, otherwise it will cause CI4 to throw errors.Ozar
Thanks! Yes. Herd isn’t Laravel-only, and that’s what makes it such a nice fit for CodeIgniter as well. The folder name rule is the one thing that trips people up most often, so once that’s clear, the rest of the setup tends to be smooth. Glad to hear the post helped clarify it.