Plugins
Grav is fully extensible with a powerful Plugin architecture to allow you to extend the core functionality and add as much functionality as you like.
Plugin Basics
Plugin Basics
Grav was designed to be simple and focused, dealing with pages only. The idea is that Grav itself is super-lean, providing just enough functionality to do the basics: routing, Markdown to HTML compiling, Twig templating, and caching.
However, we knew that we wanted to ensure...
Plugin Installation
Plugin Installation
Installation
Installing a plugin can be done in one of three ways:
The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command.
The manual method lets you do so via a zip file.
The admin method lets you d...
Plugin Tutorial
Plugin Tutorial
Plugins are usually developed because there is a task that can not be completed with Grav's core functionality.
In this tutorial, we will create a plugin that helps Grav to deliver a random page to the user. You have probably seen similar functionality on blog sites as a way to...
Event Hooks
Event Hooks
In the previous Plugin Tutorial chapter, you might have noticed that our plugin logic was encompassed in two methods. Each of these methods onPluginsInitialized and onPageInitialized correspond to event hooks that are available throughout the Grav life cycle.
To fully harnes...
Grav Lifecycle
Grav Lifecycle
It is often useful to know how Grav processes in order to fully understand how best to extend Grav via plugins. This is the Grav lifecycle:
index.php
Check PHP version to ensure we're running at least version 7.1.3
Class loader initialization
Obtain Grav instance
Gra...
Using Flex in a Plugin
Using Flex in a Plugin
Introduction
Flex usages, be in twig or in code, will be only covered for the purpose of this introduction. To understand the power and flexibily of Flex, please read our dedicated Flex documentation.
Flex allows custom Objects CRUDS, as single object or collection, an...