Commerce

Statamic - the Laravel CMS

Martin Welte

Senior Developer

Introduction

Since Laravel's first release in 2011, it has become the dominant php framework. In the meantime, various CMS systems have been built on it. High time to take a closer look at such a CMS system. This article takes a closer look at the CMS Statamic. What makes the CMS stand out, what are its use cases and what are its weaknesses.

Why Statamic

Statamic is built on the Laravel core. This means the concentrated power of a Laravel application in combination with your CMS. Laravel's approach has always been to give its users a lot of freedom and to decouple all functionalities from each other in such a way that they can be easily exchanged. This basic idea of flexibility has been adopted in statamic. You want to use your own template engine? You can. You want to use it as a headless CMS? Nothing stands in the way.

The business perspective

Precisely because statamic is based on Laravel, it is easy to find developers for it. Compared to other CMS systems, it is also quite cheap to run. Initial $259, for each additional year $59 for updates. Considering the included functionalities, which would be guaranteed by paid extensions in a comparable product. The backend interface is easy to use and understand, especially for non-technical users.

Out of the box, statamic comes with support for user management for roles and groups, a form generator, a separate generator for content and data structures. Navigations, a media library and taxonomies are also native functions. It also supports revisions and histories. Multilingualism is also no problem for the CMS.

The developer perspective

As a developer, you have the concentrated power of Laravel at your fingertips. You can use Laravel's routers, models, controllers and REST Api directly. If you want to ensure the integrity of your application, you can write automated tests with little effort, as you are used to from Laravel. Statamic also provides a comprehensive CLI to automate tasks such as exports or interactions with external platforms.

Installation

To install Statamic you can simply follow the documentation

https://statamic.dev/quick-start-guide#install-statamic

TL;DR

Option 1:

Statamic is a dependency in Laravel. You can install it like any other dependency in Laravel, and you just need to add an autoload script in the composer.json file.

Option 2:

Install the statamic CLI as a global composer dependency via "composer global require statamic/cli" and then run "statamic new $project_name"

The positive

Customising Statamic is amazingly simple and incredibly fast. It is installed and set up very quickly. If you are used to Laravel, adding rods and logic will not be an obstacle. You can use Laravel's Eloquent ORM, the artisan console, and tinker - in short, everything that makes Laravel development so great. Statamic also comes directly with a REST Api for the entire content of statamic. This means you can also use statamic directly as a headless CMS.

The strange thing

As a developer, the idea of a CMS system without a rational database seems strange. Statamic stores the content as files in the file system, and then aggregates this data in an index-based storage system in the Laravel cache. Laravel gives you the freedom to choose the cache driver. You want to use Redis? No problem. You can probably guess what I'm getting at. Most of the content is then delivered via Redis. Just like you would do with a rational database. The point is - if most of the content is delivered directly via the cache anyway - it doesn't make much difference what storage solution is used. Files can also be tracked directly via Git. This enables direct version control of the entire content.

Another peculiarity in my opinion is the templating language Antlers, which is a kind of extended Twig. Admittedly - it is easy to read and takes over some of the time-consuming work of day-to-day business. But I still get sick when I see it. The main problem I have with the approach is that the templates take over a lot of the actual business logic. And thus inevitably lead to a merging of logic and presentation.

Still not convinced? Fine, use a rational database (this is already supported for the user model in the standard version). For everything else, you will have to write your own database migrations to keep the other files synchronised with the columns of a rational database. You can also use the Eloquent drivers and models as usual, just as it would work in Laravel.

Conclusion

Statamic is a great CMS that shines above all through its simple integration into Laravel. The most promising use-case for the application is certainly the addition of CMS content to a web application. Otherwise, external CMS systems are often used in the Laravel context and their content is embedded in the application. Statamic therefore makes the use of multiple systems obsolete and thus minimises complexity.

👀 Weiterlesen, weiterkommen.