The Mijingo Blog

Latest news, updates, free tutorials, and more from Mijingo.

How to Install Craft 3

by Ryan Irelan

Now that Craft 3 is available (as of this writing it is still in public beta), it’s time to learn how to install it.

There is one pre-requisite to installing Craft 3:

  • Install and configure Composer

What’s Composer? It’s a dependency management tool for PHP that helps manage software needed for individual projects (as opposed to traditional package managers that let you install software on your computer or server globally.)

Don’t have it installed yet? Watch my video install Composer.

After that you’re ready to install Craft 3. Here’s how:

 



The Pieces of Git

by Ryan Irelan

As far as the Git workflow is concerned, there are three pieces of Git that we should be aware of before moving forward with some slightly more complex (but totally doable!) explanation.

They are:

  • Repository
  • Index
  • Working Tree

Let’s cover each one in a bit more detail.

Repository

A repository is a collection of commits, and a record of what the project’s working tree looked like at one time. You can access the history of commits via the Git log.

There’s always a current starting point in a repository and that’s called the HEAD. A repository also contains tags and branches.

The job of the repository is to be the container that tracks the changes to your project files.

Working Tree

This is a directory on your file system that is associated with a repository.

You can think of this as the filesystem manifestation of the repository. It’s full of the files you edit, where you add new files, and from which you remove unneeded files. Any changes to the Working Tree are noted by the Index (see below), and show up as modified files.

Index

This is a middle area that sits between your Git repository and your Working Tree.

The Index keeps a list of the files Git is tracking and compares them to your Working Tree when you make changes. These changed files show up as modified before you bundle them up into a commit.

You might have heard this called the staging area where changes go before they are committed to the repository as commit objects.

If you ever use the -a flag when committing, then you are effectively bypassing the Index by turning your changes directly into a commit without staging them first.

Learning More About Git

To learn more about Git check out our Git courses, lessons and tutorials.

Learn more about Git

What is the Element API in Craft CMS?

by Ryan Irelan

The Element API is a first-party plugin by Pixel & Tonic that allows you to create an API for sharing your data from Craft CMS. The responses are formatted as JSON (what is JSON?).

Using the plugin you can create an API that exposes Craft Elements via a JSON-formatted responses. The API only is read-only. You cannot write to Craft using this API and there’s no authentication built in. Be careful what you share!

The Element API is made up of the following pieces:

  • The plugin package itself
  • The elementapi.php file you have to create
  • The code in the file that defines the endpoints and the exposed data

To use the Element API plugin you need to meet these requirements:

  • Craft CMS installed and populated with data you want to expose via the API
  • PHP 5.4 or later (different than the current requirement for Craft CMS)

Installing the Element API plugin is like installing any other Craft plugin: drag the plugin file to the plugins directory and then install the plugin via the Craft Control Panel.

Watch the Free Lesson

How to Create an API with Craft CMS

by Ryan Irelan

In a recent lesson, I walked through how to use the Element API Plugin from Pixel & Tonic to create a JSON API that shares your website’s data (only that data which you choose, of course) for consumption by another website or service.

The free lesson is a fundamental approach to building a read-only API using the default ElementTypes (entry, category, asset, etc) in Craft. As long as you follow my steps, you can get an API up and running quickly.

Toward the end of the lesson, we also learn how to expose your Craft Commerce order data via an API so you can have an outside tool (like a Goole Spreadsheet or reporting tool) ingest it and use it create some sort of report.

Watch the Lesson

Learn Craft Commerce

by Ryan Irelan

It used to be that doing e-commerce work was something I would talk a client out of or offload to another company or a hosted platform. I didn’t want to touch it. At all. Too much risk. But this caused me to lose business and it usually meant a less-than-ideal solution for my clients or customers. Thankfully, the e-commerce solutions have gotten a lot better.

One those solutions is Craft Commerce, a first party plugin for the Craft CMS.

With tools like Craft Commerce, most web developers can put together a powerful and flexible e-commerce system for any website. And the store is hosted right on the website, not on some third party platform you can’t control.

In my full-length course Fundamentals of Craft Commerce I teach you everything you need to know to get started using Craft Commerce.

 

This new course follows the same proven learning process you expect from my Mijingo courses. By the end of the course you will be ready to implement your first e-commerce website!

Start the Course for Free