- February 20, 2014
About That Craft CMS
Times are changing in the PHP world. Some call it the PHP Renaissance. PSR standards are bringing interoperability between frameworks and unity to coding standards. Composer offers access to an array of best-in-class components and a simple way to integrate them into your applications. There are some great, new PHP language features showing up like Traits and more. A new breed of frameworks and content management systems are getting on board. It’s a great time to be a back-end developer!
In a world that requires specialized Drupal developers, Wordpress developers, ExpressionEngine developers, and other pre-renaissance CMS developers, Craft CMS gives me hope for a day when being a PHP developer is enough.
Craft was built on the cusp of the renaissance by the friendly folks at Pixel & Tonic. It has the earmark of systems built on modern principles. It makes every effort to avoid quirks that steepen learning curves. It sticks with standard, familiar design patterns and components.
What sets Craft apart is its friendliness toward front- and back-end developers alike. It has all the charm of a low-configuration, highly portable, easy-to-use platform and all the confidence-inspiring familiarity of a modern framework.
Here are a few of my favorite things about Craft:
Clear application structure
Craft is built on the Yii framework. This was my first experience with Yii, and, while I didn’t dive into it directly, the Craft core application felt familiar from the start. The file structure is predictable and sane. Classes and their methods are easy to read and well-documented. If you’re the source-code-reading type, you won’t feel lost at all.
Twig is a popular template engine for too many reasons to list here. Its object-oriented dot syntax is easy to understand and maps directly to data structures. Pixel & Tonic could have rolled its own but it stuck with arguably the best PHP template language available.
The plugin architecture is as simple as it can get, and that says a lot. It’s easier to build complex systems than simple ones. In no time at all, I was adding custom Twig filters, creating a custom login experience, and all that jazz. Here’s a sample plugin I put together. We needed WordPress-style shortcodes, so I ported the WordPress shortcode function over to a Twig filter.
When building a plugin, you have access to the application class instance through the function
craft(). Then, through autoloading magic, you have easy access to all of Craft’s service classes such as
craft()->entries, and so on. Piece of cake.
I’ve built plenty of custom plugins for WordPress, ExpressionEngine, and Drupal. After Craft, I envision myself writing a plugin for one of the others alone, sobbing, in a corner, listening to country music.
The wysiwyg editor is central to any content management experience. Pixel & Tonic have a very popular wysiwyg editor for ExpressionEngine called Wygwam. Why not use Wygwam in Craft rather than spend money on a commercial product like Redactor? Redactor is probably the nicest wysiwyg I’ve seen from both a user’s and developer’s point of view. It’s a solid product with a dedicated development team behind it. This again shows Pixel & Tonic’s commitment to avoiding quirks and sticking with the best components available.
Easy database backup
With multiple devs working on the same project, I think the “data down, files up” approach works really well. Add new fields on a shared development server, download the database from the admin panel, then update your local database. Easy breezy.
If you’ve used Pixel & Tonic’s ExpressionEngine Matrix field, you know its power. Matrix comes standard in Craft and is even better. We built an internal site almost entirely around the Matrix field. Each block was a type of content—say a paragraph, a video, or a testimonial. Each block had its own fields, including a “placement” field that allowed us to designate where it should go in the template. If you ask me, the real power is in how Matrix’s data maps to Twig’s dot-syntax. This is nerdy talk, I know, but if you’re nerdy then Matrix is cause for much rejoicing!
If you’re a maverick like me, you like to figure things out on your own. Craft is still young, and the name isn’t SEO-friendly. Ordinary Google searches aren’t much help, but the support form in the admin panel sure is. Even better, I joined the Google+ group and got quick, helpful answers. The Craft team is clearly dedicated to helping its users get things done.
I could go on, but I’d rather hear from you. What has your experience been like with Craft?