Craft3 + Local Environment: Day 1 with Mamp Pro + Navicat

July 2018

Craft3 + Local Environment: Day 1 with Mamp Pro + Navicat

It's no secret I like working with CraftCMS. It's powerful, it's flexible, twig is pretty easy to wrap your head around, it doesn't have the security issues some other content management systems seem to have (*cough* wordpress *cough*), and after working with ExpressionEngine for years it was easy to make the move.

The newest release major release, craft3, works the same on the surface - front end site, admin section - but everything underneath has changed. Stealing content directly from Straight Up Craft:

Craft 3 is available as a composer package and enables developers to manage plugins as composer packages as well. While this is exciting news for some, it's also a source of confusion for many users who don't use composer on a regular basis.

That just... all sounds scary. What's composer? What's it building? Why do I need to care? So for a while, I didn't even look into it. You can still download and ftp craft3 to the server. You can still run a setup wizard. I stuck with that as long as I could.

And then it happened. I decided to get fancy this latest project. We're using Sprout Forms so the client can create a bunch of reports for her users to fill out. There's only about a dozen different reports but some of the fields she wants are pretty specific. I was trying to think of some ways to hack up the field template overrides when I stumbled upon their docs for developing your own form fields. Oooh, that's interesting. But these custom fields are plugins and plugin development means getting into composer and composer is only command line and most shared host packages don't allow shell access... So in a regrettable(?) end of day decision I decided to set up a local development environment.

Fuck, where to start?

So I asked some follow web dev friends and colleagues and Sean gave me the low down on setting up a local dev environment on a Windows machine. His advice was Mamp Pro and Navicat. They both have trial periods before you have to shell out money.

I'm not going to lie. It wasn't an easy evening. I went down a whole rabbit hole trying to get OpenSSL working and when I finally asked Sean he said he doesn't bother because "it never works" locally. An hour wasted!

I had php config issues. I had install and path issues. Composer wouldn't run and I'd change this php.ini file and restart the local host and composer would run but when I had to reboot for some other reason composer wouldn't run again.

There was swearing - lots of swearing - but no tears so not my worst work day. At the end of a very long evening I had a local copy of the dev site. I was annoyed, I was proud, I was tired, I was determined to push forward. But mostly, unfortunately, I think I just wanted to get through it so badly that it wasn't until a day or 2 later that I thought I should write about what I went through. I didn't take any notes to help you, dear reader, out. Sorry. I'll try to pay more attention from now on.

And I think it's important to note, I still don't know exactly what composer is or how it works. I type in console commands I find in craft documentation and better written posts.

Next: writing custom plugins