Interviewed by Snipcart

Last week, Snipcart interviewed me as part of their Geek Talk series. In this wide-ranging exposé, we cover such thrilling topics as my favourite programmer and favourite quote, and we even find time to discuss some developer-type things.

The Hidden Perils of Craft Plugin Service Classes

When writing a Craft plugin, you should be very selective about what you put in your service classes.

This advice appears to run contrary to the guidance given in the official Craft documentation, and keeping your plugin code in service classes is certainly preferable to keeping it in your controller of variable classes. But it’s still a bad idea.

Here’s why.

How and When to Use PSR-4 Autoloading in Your Craft Plugins

If you’re developing a reasonably sophisticated Craft plugin, chances are you’ll have a lot of class files which don’t really fit into the “standard” Craft plugin sub-directories of models, records, and so forth.

In this situation, you need a way to easily loading your “non-standard” classes as-and-when they’re required. PSR-4 autoloading is the perfect solution to this problem, and by the end of this article you’ll know everything you need in order to use it in your plugins.

Introducing Glossary for Craft

Today, we’re proud to release Glossary, a new Craft plugin.

Glossary makes it easy to implement a list of entries, grouped by X and ordered by Y. For example:

  • A list of staff members, grouped by the first letter of their surname, and ordered by forename;
  • A list of countries, grouped by continent, and ordered by population;
  • A list of recipes, grouped by cooking method, and ordered by cooking time.

It’s possible to achieve all of the above using Twig, but the result is messy and difficult to test.

Glossary keeps your templates neat, and has a suite of unit tests to ensure everything runs smoothly.

Newer articles

Bend Craft to Your Will

Our newsletter helps you make the most of Craft. Join for free, leave any time.