Benefits of using grav

Benefits of using grav

  • March 04, 2020
  • by Tanupriya Nahal
  • Web Development

# Why choose Grav?

Grav is a modern, flat-file CMS, developed by RocketTheme. It is considered as modern because it uses the latest PHP, Markdown, Twig, and Yaml. Besides that, it does not use any database and instead all the site’s content and configuration settings are stored in plain text files. Hence loads faster than a database supported website.

# Achievements

- Voted "Best Open Source CMS" in 2016 

- Voted "Best Flat File CMS" in 2017 and 2019!

# Easy Installation

To run Grav, you only need a web server and PHP 5.5.9 or higher. That’s it.

  • Download the Grav core + Admin plugin.
  • Unzip it within your webroot.
  • Point your browser to the unzipped Grav folder.
  • Create an administrator account.
  • You can start adding content straight away.

# Grav Administration Panel

The Grav admin plugin provides a simple and intuitive interface to make configuration and content creation easy and enjoyable. It can easily create and modify pages. Add new plugins and theme modifications.

# Performance & Caching

Cache mechanism makes Grav faster in which browser can get files from the cache rather than the original server which saves time and additional network traffic. Grav uses the Doctrine Cache library.

Core Grav caching has the following configuration option as configured in your user/config/system.yaml file:

cache: enabled: true  # Set to true to enable 

* We can also enable and disable the cache of a specific page by configuring this option at the page level.

* You can clear the cache by deleting all the files and folders under cache/ or by just clicking the option under the admin interface to clear the cache.

# Markdown for writing content

Markdown is plain-text formatting syntax. For example, GitHub uses it for documentation and readme texts. It is very safe and simple to use. Markdown is just text which is then dynamically converted to HTML and displayed in the browser. It is intuitive compared to HTML syntax. 

For example, For writing headings

  • #my new Heading
  • ##my new Heading
  • ###my new Heading
  • ####my new Heading
  • #####my new Heading
  • ######my new Heading

# Code Reusability

This is the most beneficial feature provided by Grav. It saves a lot of time as well as code for Developers. We can create a block or module and use it on any page with just including that template to that page. 

For example, I have a sidebar in which I would like to create some boxes which list links to external websites. In order to separate content and presentation, I created a separate page with sidebar folder and include that on all pages wherever I want but just including it like the following way

# Git-Sync Feature

Git Sync is a Plugin for Grav CMS that allows you to seamlessly synchronize a Git repository with your Grav site, and vice-versa. Once installed and configured it provides seamless bi-directional syncing which is possible with a variety of Git services, including GitHubGitLab, and BitBucket for both public and private repositories. With the configuration of a Webhook, the Git repository gets the appropriate branch updated the live Grav website will get immediately refreshed with the accepted changes as well. Likewise, when working with the Grav Admin Panel any saved changes to the website, such as adding/deleting pages or editing page content, get automatically committed to the Git repository.

# Simple Backups / Restore

Most content management systems (CMSs) have security and backup plugins available to improve performance and security to your preferences. Grav includes these features natively within the Admin plugin. Grav offers options to configure what’s included in backups, different backup configurations with specified schedules, and how many backups to retain at once.

# Easy Sorting of Menus

Sorting of menus can be done manually or by using drag and drop features provided at the admin end. I f you want to do sorting of pages or menus, it can simply be done by adding numbers with names of the page folders.

For example, we can rename the pages folder as


# Easy Database Connectivity

We can easily deploy Grav project without database connectivity but still if you need some dynamic content in your pages or you want some database connectivity then it would hardly take a few minutes to create a connection.

For that, we need to define the database parameters in the config file of your plugin where you want to access database as,

mysql_server: localhost
mysql_port: '3306'
mysql_username: root
mysql_database: database_name

And can access that in plugins like,

//Connect to DB
        $server = $this->config->get('plugins.pluginName.mysql_server');
        $port = $this->config->get('plugins.pluginName.mysql_port');
        $user = $this->config->get('plugins.pluginName.mysql_username');
        $pwd = $this->config->get('plugins.pluginName.mysql_password');
        $db = $this->config->get('plugins.pluginName.mysql_database');
        $db_con = new \mysqli($server, $user, $pwd, $db, $port);

I hope the above mentioned benefits are the core features we need for web development. If you need a modern, lightweight CMS, with clean and comprehensible architecture, then Grav may be the right choice for you too.