The journey & exploration of Statamic

Published

Take your static site to the next level. Exploring Statamic for content management

As the Universe would have it, a conversation earlier in the week was had with a local non-profit that was moving away from WordPress.

Immediately I asked ‘to what platform?’.

Statamic - go ahead, try to pronounce that.

Next question became the ‘why?’.

On-going maintenance and WordPress plugin clog.

Yes, the clog that sucks your time troubleshooting which plugin is causing conflict or whatever. Content lock-in and who knows what else.

The fact that this is a flat file solution intrigued me further.

What is here

Similar to what can be produced with Netlify CMS, Statamic takes it a step further for managing content. { very intruiged }

After watching a few videos, I decided to give it a go.

This is my quick installation journey, with updates to this post on an on-going basis to see how it goes.

Fresh re-built MAC

I have re-build my local machine … so there are a few additional items in here that may not be applicable to you (you may already have it!)

Getting set up

Here we’re going to follow the ‘Local Installation’.

As stated

Running Statamic locally is the preferred method for building and maintaining your sites.

Because I’ve had to re-build my machine recently, will need to set up a few things as well.

What’s required

On you machine, have ready

  1. Homebrew 
  2. Composer
  3. PHP

Yes, there are a few ways to install Composer, so we’ll go with the Brew method

Brew it up

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

PHP8

After installing Homebrew … let’s install PHP v8

brew update
// brew install php
// To install a specific version, run this command:
brew install php@8.0

https://hbakouane.medium.com/update-php-to-version-8-in-macos-using-homebrew-75c292e4a2d3

This take a bit …. Bleep … bloop.

After all that, I get (ignore this if you already have PHP installed)

To enable PHP in Apache add the following to httpd.conf and restart Apache:
	LoadModule php_module /usr/local/opt/php@8.0/lib/httpd/modules/libphp.so

	<FilesMatch \.php$>
		SetHandler application/x-httpd-php
	</FilesMatch>

Finally, check DirectoryIndex includes index.php
	DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
	/usr/local/etc/php/8.0/

php@8.0 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have php@8.0 first in your PATH, run:
	echo 'export PATH="/usr/local/opt/php@8.0/bin:$PATH"' >> ~/.zshrc
	echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.zshrc

For compilers to find php@8.0 you may need to set:
	export LDFLAGS="-L/usr/local/opt/php@8.0/lib"
	export CPPFLAGS="-I/usr/local/opt/php@8.0/include"

To start php@8.0 now and restart at login:

	brew services start php@8.0

Or, if you don't want/need a background service you can just run:
	/usr/local/opt/php@8.0/sbin/php-fpm --nodaemonize

Check php version

php -v

Produces:

command not found: php

Will need to:


echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.zshrc

Start it up

brew services start php@8.0

Check your version again, you should see something like this:

PHP 8.0.29 (cli) (built: Jun 15 2023 05:24:31) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.29, Copyright (c) Zend Technologies
with Zend OPcache v8.0.29, Copyright (c), by Zend Technologies

Composer

This is next …

brew install composer

Test it by running

composer

Stamatic

composer global require statamic/cli

If composer is not able to find statamic, then check this:

https://statamic.dev/troubleshooting/command-not-found-statamic

New project

Go

statamic new $project_name

Because we have not installed Valet (yet!), let’s dig in

cd $project_name

php artisan serve

That’s it …

Off to 127.0.0.1:8000 land

Start learning

https://statamic.dev/

Is Statamic right for your next project?

Highly impressed with the administration and managing content, but for simpler websites (i.e., brochure-ware), this would be too much.

Without getting in to the details, this post reflects a few things I am thinking as well.

https://daniel-saunders.com/posts/essays/how-i-learned-to-stop-worrying-and-love-the-jamstack/

Have fun!