St - St - St – Statamic 3

Part 3: Installing Statamic

Statamic 3 is installed using Composer.

Browse to the root folder of your new Valet environment with cd ~Sites/ or where ever your hosting is located on your local machine. If you are using Visual Studio Code then the built-in terminal is super handy from hereon in.

The following code installs Statamic’s starter project inside a folder called my-first-project. Change it to whatever suits. e.g. For this site I created a folder called ellimondo.

composer create-project statamic/statamic my-first-project —prefer-dist —stability=dev

NB The statamic/statamic installation is not a totally clean install. It adds a couple of extras that you might not want. First it installs Tailwind and Laravel Mix. If you want the plain version then I guess you would use statamic/cms instead but I haven't tried that.

It's really not clear in the documentation that this is the case.

User friendly?

My first question, upon installing Statamic, was 'How the hell do I get into the control panel?'

A CMS needs users. If you want to add a user then you need to use a terminal command. Once you’ve got one user then you can log into the CMS. This isn’t clear to a newbie and I was scratching my head when I started playing around in the browser.

php please make:user

The script asks you a few questions. Make sure you say yes to a superuser. Super!

You are now ready to log in. The control panel lives over at your-domain-name.test/cp.

Other users can be added this way or through the control panel, once you've logged in.

Statamic concept

If you are reading this then it's pretty clear you already know what Statamic is. Otherwise you are clearly a psychopath or need a new hobby.

The important thing I've learned is that although Statamic doesn't use a database it does store data somewhere. This is called The Stache. It's basically a database.

Statamic is not a static file generator out of the box. But it does have that capability. More of that later.

Like databases The Stache is a bit eggy and does get confused from time to time. You often end up with an error screen when things go screwy. You can usually fix this easily in the Terminal with php please stache:clear or the global php please cache:clear.

You can also use the control panel to clear cache but I've found it doesn't always work – often you can't get to the page as it's erroring! (> Utilities > Cache Manager).

The World of Statamic is full of puns. As a "Dad who tells awful jokes" it's quite appealing. But it might get a little wearing over time, although it certainly beats the dry wastelands of Perch's documentation.

Folders & Files

So now you have a folder full of stuff. If you are coming from Perch then your file structure is going to look very messy.

Here are notes on a few of the important folders. Please note that some of the concepts changed even during my short time of using the Beta.

/config

This is where all your settings go. Like the perch/config/ folder.

/content

This is where all your content lives.

Silos of data are called Collections just like they are in Perch Runway. Pages are included in this.

Globals are like Shared Regions in Perch.

Assets are the same as Perch's Assets: Images, files and other media.

Taxonomies are like Perch's Categories. Except that they can be anything you like.

/public

Laravel uses this folder to load the site from. It's the root of the application. Everything outside it is therefore not accessible to the outside world.

It's where your css, js and asset files get sent to by Statamic.

You must assign this folder as your root folder in your hosting options.

/resources

Resources contain files that control content. /blueprints control the way your edit pages look while /views control the way your pages look.

/routes

web.php wires your urls to certain views and acts much like routes in Perch.

.env sits in the root folder and is the master config file. This is part of Laravel. This is where you add licenses, email settings etc. Much like Perch's config.php file but it acts at a level above the files in /config.

Part 4: Installing Mix