DEV Community

Cover image for Why and how I'm simplifying my dev life by moving Symfony Station to Grav CMS
Reuben Walker, Jr.
Reuben Walker, Jr.

Posted on • Originally published at symfonystation.mobileatom.net

1

Why and how I'm simplifying my dev life by moving Symfony Station to Grav CMS

This article originally appeared on Symfony Station

In this article I explain why I'm following in the footsteps of moving my Mobile Atom Code site to Grav CMS with the Symfony Station site.

Why

Simplicity

Now that I am 99% retired I don't want to fuck with websites 60 hours a week. Especially as I still have three hobby projects I want to keep running. They slow my mental decline and ameiliorate lifelong depression. Plus, I need extra time for morning caffeine and afternoon alcohol. And most importantly, naps.

Also, after almost four years, I now know what I want Symfony Station to be. I have determined which platforms to distribute it on for maximum impact with minimal effort.

That's why our newsletter recently got the boot. Double work for not many eyeballs wastes time.

And I have perfected my workflow.

Grav aligns with this reality and is the closest option to Symfony that is also simple.

Close to Symfony

Grav is a Symfony-influenced CMS. It uses:

  • Twig Templating: for comprehensive control of the user interface
  • Markdown: for easy content creation
  • YAML: for simple configuration
  • Parsedown: for fast Markdown and Markdown Extra support
  • Doctrine Cache: for performance
  • Pimple Dependency Injection Container: for extensibility and maintainability
  • Symfony Event Dispatcher: for plugin event handling
  • Symfony Console: for CLI interface
  • Gregwar Image Library: for dynamic image manipulation

PHP

Grav is 99% PHP.

In fact it is 99.7 percent PHP. You can't beat that.

Obviously I love and support the PHP development community. I have used it for years in my business, primarily via WordPress and lately Drupal. And I cover it extensively on Symfony Station. So Grav CMS is a no-brainer as an option for building sites.

No database

Grav is a flat file CMS. So, it doesn't require a database. Which is why its simple and awesome. No headaches and no horseshit required.

Drupal is too complex

Aside from Sulu CMS, I have viewed Drupal as the CMS most closely integrated with Symfony. And that is why I originally built Symfony Station with it. It helped me move toward mastering Symfony. This was especially true from the architecture and business logic perspectives. Unfortunately, Drupal is anything but simple. In fact, it's the opposite of simple in every way imaginable.

While improving slowly, it is still a pain in the fucking ass to maintain.

And I have no faith that Drupal automatic updates will ever happen.

So, in spite of learning alot by using it and getting some extra commercial work from that knowledge, Drupal is getting the boot.

Having said that, I met many wonderful people at the last few DrupalCamp Floridas and DrupalCon Lille.

And I'm not leaving the community. Even though I'm retired and no longer accepting clients, I will maintain the Mobile Atom Media site to experiment with Drupal.

I also have an idea for a charitable initiative when I move to Europe next year, so I want to stay in the game.


How I Did It

So, how did I build the new site.

Installation

You can install Grav CMS by following its documentation.

Or if your hosting service provides access to Softculous, use it. Which is what I did.

Theme Creation

There are a variety of ways for making a Grav theme meet your simple or complex needs, but Grav provides features and functionality to make it even easier. And they are the way I createded my site's theme.

That easier way is to use theme inheritance. I like this option because it's similar to what I have done with WordPress and Drupal themes.

It's also Grav's preferred way to customize a theme.

You define a base theme that your are inheriting from. For example the default theme Quark in my case. Then you add or edit what you want customized and let the base theme handle the rest.

This strategy also let's you update the base theme without losing the customizations of your inheritance theme.

There are several ways to create an inheritance theme. But in the interest of simplicity, let's look at the manual process. I:

  • Created a new folder -> user/themes/my_theme_name to hold the custom theme.

  • Then copied the YAML file from the theme (Quark) I was inheriting from into the new folder. Named it my_theme_name.yaml and switched the new theme name wherever I saw Quark.

  • Copied the users/themes/quark/blueprint.yaml file into my user/themes/my_theme_name folder.

  • Changed the default theme in the user/config/system.yaml file with:
    pages:
    theme : my_theme_name

  • I set up Grav's streams so that it looks in my_theme_name first, then tries Quark.

Now I needed to provide the CSS, JS, and Twig template modifications I required.

Twig fun

Symfony and Twig have the same papa, Fabian Ponticier.

He created Twig as a modern template engine for PHP. And it has many benefits.

It is fast because it compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code is reduced to the very minimum. It can be used for applications where users need to modify the template design. And Twig is powered by a flexible lexer and parser. This allows developers to define their own custom tags and filters, and create their own DSL.

In Grav CMS, Twig templates control page architecture and interactive behavior from plugins as well as any custom componentized Twig files. Atomic design is always best, peeps. Separation of concerns, etc.

I edited the base.html.twig template with Twig and the footer.html.twig template with some HTML along with a touch of inline CSS. And maybe some other templates but not many.

Markdown

One of the most appealing draws of Grav is that it uses Markdown for content creation.

I was first exposed to Markdown in my coding bootcamp. And I loved it. Obviously it is used extensively in software documentation.

Nowadays, I do all my writing in Markdown via the Joplin app. Copy and pasting takes one-tenth the time of reformatting to Gutenberg.

Frontmatter

This works with Markdown and Twig to aid in adding interactivity. That includes automatically pulling new articles and communiqués into their listing pages. If you do not know, Frontmatter adds meta-data to your Markdown.

CSS

Grav pages can be written in Markdown (as noted above) and/or HTML.

Custom CSS and JS are added via Grav plugins. Which is fantastic because I love vanilla CSS and hate frontend platforms. I also hate JavaScript. Because Grav CMS is 99.7% PHP and uses Twig, I only have to add the JavaScript I absolutely need for functionality and interactivity. Which is next to none. Unfortunately, I needed a little for the mobile navigation and search functionality.

Obviously, I used cutom CSS for my design.

Plugins used:

  • Custom CSS
  • Editor
  • Admin Power Tools (needed for Editor)
  • Core Service Manager (needed for Editor)
  • Pagination
  • Aura (SEO)
  • SiteMap (SEO)
  • SimpleSearch

Most of those are self-explanatory. And all of them had to be configured to work with my site's uniqueness.

Editor let's me edit PHP, CSS, JS, Twig, and Markdown files directly from the admin. Which is handy.

Aura generates metadata automatically. But, if you have a small site, it’s more trouble than its worth.

Documentation

Grav's documentation is very good. Which is fortunate, because I made significant use of it throughout the redesign and migration.


Conclusion

So, thanks for reading about this ongoing project.

The new architecture and UI are finished. You can see it here. Feel free to contact us with any suggestions.

Obviously, the site is not finished.

I am finalizing the design which won't take much longer.

And I am manually migrating content which will take a while. I’m deleting, updating articles, and substituting images for articles and communiqués to better fit the redesign.

Afterwards, I will have to add redirects or update links.

Once the new design is live, I will close my Mobile Atom Code site. One site each built with Drupal, WordPress, and Grav is enough.

If I end up really loving my theme, I will upload it to Codeberg so anyone can fork it as a child theme to Quark.

So, please take a look at Grav CMS and keeping following Symfony Station. I truly appreciate it. Look for the new site to go live in a few months.

Au revoire, Symfonistas!

Author

Reuben Walker headshot

Reuben Walker

Founder
Symfony Station

Top comments (0)

Real Talk: Realistic Voice AI with ElevenLabs

ElevenLabs is joining us to talk about how to power your applications with lifelike speech. Learn how to use ElevenLabs to enhance user interactions, build low-latency conversational agents, and tap into one of the leading AI voice generators.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️