Skip to content

Powered by Grav + Helios

Local Development with reeve

Local Development with reeve

reeve is an open-source local web development stack for macOS and Linux, with a terminal dashboard and a CLI. It manages the web servers (Apache, Nginx or Caddy), PHP versions, local SSL certificates and .test DNS for you, using Homebrew-installed packages run as your own user, so there is no sudo for day-to-day work and no Docker.

It has built-in support for Grav:

  • Grav sites are detected automatically. Park a folder and every Grav site in it is served at https://<folder>.test, with no per-site setup.
  • Grav's security rules are applied on every server. Apache uses Grav's bundled .htaccess; on Nginx and Caddy, reeve adds the same rules from Grav's shipped webserver-configs/, so user/config, user/accounts and the rest are protected just as they will be in production.
  • PHP per site. Each site can run its own PHP version, and versions run side by side, which is handy for testing a site on PHP 8.3 and 8.4 before upgrading your host.

Install reeve

Install it with Homebrew (reeve offers to install Homebrew if you don't have it):

BASH
brew install yetidevworks/reeve/reeve

Then set it up and install PHP. Grav 2 needs PHP 8.3 or newer:

BASH
reeve init                 # scaffold reeve's config, local certificate authority and DNS
reeve php install 8.3      # install PHP 8.3 and its PHP-FPM
reeve dns setup            # make *.test resolve to this machine
reeve ssl trust            # trust reeve's certificates in your browsers

reeve dns setup and reeve ssl trust ask for your password once. Quit your browser completely after ssl trust so it picks up the new certificate authority.

Note

On Linux, reeve needs systemd with a user session (Ubuntu works out of the box). reeve init offers to let your user bind ports 80 and 443. See the reeve README for details.

Add a web server

Add Apache, which reads Grav's .htaccess just like most hosts do:

BASH
reeve server add apache
reeve server start apache

You can use nginx or caddy instead, or run several on different ports (reeve server add nginx --http 8080 --https 8443) to check a site on each.

Serve your Grav sites

Create a folder for your sites and park it, so every Grav site inside is served automatically:

BASH
mkdir -p ~/Sites
reeve park add ~/Sites --server apache --php 8.3 --ssl

Download Grav into it. The Grav + Admin package includes Admin Next:

BASH
cd ~/Sites
curl -L -o grav-admin.zip https://getgrav.org/download/core/grav-admin/latest
unzip grav-admin.zip && rm grav-admin.zip
mv grav-admin my-site
reeve apply

Open https://my-site.test. On a fresh install every page redirects to the admin's setup page, where you create your administrator account.

Every new folder you add to ~/Sites is picked up the next time you run reeve apply (or press a in the dashboard). reeve recognizes a Grav site by its system/defines.php and user/ folder, and the folder name becomes the host name, so ~/Sites/blog is served at https://blog.test.

Tip

To serve a Grav site that lives somewhere else, add it as a single site instead of parking a folder: reeve vhost add grav.test --root ~/projects/grav --php 8.3 --server apache --ssl --preset grav

The dashboard

Run reeve with no arguments to open the dashboard. It shows your servers, sites, PHP versions and services with their live status, and you can start, stop and change everything from there. Press t for a live view of the requests reaching your sites, and ? for a health check of the whole stack (also available as reeve doctor).

Useful extras

Switch a site's PHP version

Install another PHP version and point a site at it. Both versions keep running, so your other sites are unaffected:

BASH
reeve php install 8.4
reeve vhost add next.test --root ~/Sites/my-site --php 8.4 --server apache --ssl --preset grav

Use reeve php cli 8.4 to switch the php command in your terminal, which bin/grav and bin/gpm use.

Tune PHP

Change PHP settings without editing php.ini, for example to allow media uploads larger than the 64M default in the admin. reeve php settings 8.3 lists every setting you can change:

BASH
reeve php set 8.3 upload_max_filesize 256M
reeve php set 8.3 post_max_size 256M

Catch outgoing email

Install Mailpit to catch every email your site sends (form submissions, password resets, account activation) instead of delivering it:

BASH
reeve service add mailpit
reeve service start mailpit

Then set the Email plugin's engine to SMTP, with server localhost, port 1025 and no encryption, and open http://localhost:8025 to read the messages.

Debug with Xdebug

From inside a site's folder, turn Xdebug on for that site's PHP version:

BASH
reeve xdebug on

Xdebug then attaches only to requests that carry the XDEBUG_SESSION or XDEBUG_TRIGGER cookie, set by your IDE's debug configuration or a browser extension, so normal browsing stays fast. Command-line PHP keeps Xdebug off. Run reeve xdebug off when you're done.

For everything else, see the reeve README.