Grav 1.6 Released!

PHP 7.1.3+ and lots of new goodies...

8 minutes

We released Grav 1.5 back in September of 2018, and at that time we planned to have Grav 1.6 released by the end of the calendar year. Unfortunately, that didn't happen quite according to plan. This was mainly because we kept adding goodies to it, and the result has made 1.6 our biggest release since Grav 1.0.

We released our first Grav 1.6.0-beta.1 version in October 2018, and since that time we've released 7 further betas. Grav 1.6.0-rc.1 was then released in January 2019 and we have had 4 release candidates. We've received lots of feedback during this time and have addressed many reported issues. The file for this release is massive, so take your time reading over it.

Along with the Grav core, this release is also accompanied by various plugins. We are releasing Admin Plugin 1.9.0 in parallel, as well as 3.0.0 versions of Form, Login, and Email plugins.

Important Notes about Upgrading

The CLI is always the best method to upgrade, and there should be no issues upgrading from any older version directly to Grav 1.6. Simply type bin/gpm self-upgrade to upgrade Grav core, then bin/gpm update to update all the plugins and themes.

If you like to use the Admin plugin and are not already running the latest Grav 1.5.10 and Admin plugin 1.8.19, you may see a red error message during the upgrade to 1.6.x along the lines of Too few arguments to function.... This is a class loading issue and does not effect the upgrade, just the success message after upgrading. Refresh the browser and you should be find yourself running Grav 1.6 and you can proceed as normal.

Grav versions prior to 1.4.0 do not have the automated PHP version check during upgrade, so you need to ensure you are running at least PHP 7.1.3 before attempting to upgrade.

PHP 7.1.3+ Requirement

PHP Supported Versions

The most significant change with this release is the minimum requirement of PHP 7.1.3. As outlined in the original blog post on the subject from March of 2018, we covered the reasons for quickly moving to PHP 7.1.3 to allow us to utilize newer versions of the core libraries we use (Twig, Symfony, Doctrine, etc.). As both PHP 5.6 and PHP 7.0 are both no longer officially supported, it makes total sense for us to require PHP 7.1 at this time. Also, PHP 7.3 is already released and for performance improvements alone, is now the preferred version to use for Grav.

New Features

Due to the number of new features in this release we'll quickly outline a few of the key ones:

  • Move to PHP 7.1+ and core updates to take advantage of features and functionality it offers
  • New Scheduler functionality to run periodic jobs
  • New Backup functionality with multiple backup profiles and scheduler integration
  • New Log Viewer functionality to display logs in CLI and Admin plugin
  • New Reports functionality to get reports from Problems plugin, XSS vulnerabilities, and other plugins via new event
  • Refactored Asset Manager to be more powerful and flexible
  • New experimental Flex Users support (disabled by default)
  • New Grav Framework classes for FlexObjects, Routing, and others
  • PSR-7 and PSR-15 classes
  • Negotiated content types & languages support added for Accept: and Accept-Language: headers
  • New Core Events such as onFatalException, onPageContent, onSchedulerInitialized, onPageAction, onPageTask, onAction
  • Multilanguage improvements including unification of translate Twig filters/functions
  • New helper methods in Utils
  • Blueprints security and scope capabilities
  • PHPStan analysis added and code cleaned up
  • New Twig filters and Functions |get_type, |of_type, |chunk_split, |nicecron, |print_r, |yaml_encode, |cron, |nicefilesize, body_class(), http_response_code(), read_file(), regex_filter(), theme_var(), xss() + more...
  • New Twig Tags such as try, catch, throw, and render for FlexObjects
  • Upgraded to Symfony 4.2 components (was 3.4)
  • Upgraded to Doctrine Collections 1.6 (was 1.4)
  • Upgraded to Doctrine Cache 1.8 (was 1.6)

Of course, a variety of bugs, and issues have been addressed in this release to continue to ensure Grav remains fast and stable.

Please review the Grav 1.6 Changelog for a full list of new features, improved functionality, and bugfixes.


Admin Scheduler

The Grav scheduler is a new feature that as added in Grav 1.6 that allows jobs to be run on a periodic basis. The underlying processing relies on the server's cron scheduler, but once a single entry has been added to the cron service, all jobs, and specific schedules can be configured via Grav.

One of the main advantages of utilizing the scheduler to handle tasks is that they can be performed without any user interaction and independently of the front end. Tasks such as periodic cache clearing, backups, synchronization, search indexing, etc., are all prime candidates for scheduled jobs. Plugins such as TNTSearch and GitSync have already been updated to provide scheduler support. More information on using and integrating the scheduler, can be found in the Scheduler documentation.


Admin Backups

The backup system in Grav has been completely rewritten for Grav 1.6 to provide more features and functionality. The improvements include the integration into the new Grav Scheduler to allow for offline backups to run whenever you wish; the Ability to create multiple backup profiles each with their own set of files, exclude path and file rules, and schedule configuration; New auto-purge options based on number, space, or time; And new dedicated backups page in the Tools section of the admin plugin. Please check out the Backup Documentation for more details.


Admin Reports

The Reports feature primarily accessible via the Admin plugin and serves the purpose of bringing together any useful but non-critical information to the site administrator. Things such as configuration or server issues (provided by the Problems plugin), as well as potential XSS issues in content, are included in the Reports section. Also, a new event is available for 3rd-party plugins to provide their information into the reports.

Log Viewer

Admin Log Viewer

The Log Viewer is a new CLI command that can be used to display Grav log entries quickly. There is also a new Admin Plugin tab in the Tools section to make the logs accessible if you don't have easy access to the terminal.

Assets Manager

The Assets Manager is a powerful tool in Grav that provides management of CSS and JS assets for themes and plugins. One of the first jobs during the development of Grav 1.6 was to rewrite the Assets Manager completely. Originally the Assets manager was expanded to add more sophisticated support features. However, this quickly made the code a mess, and for it to be future-proof, a rewrite was needed. This new version is 100% backward compatible with existing themes and plugins, but is much more flexible and allows more control over the placement of assets in relation to one another, as well as arbitrary parameters to support advanced loading options. More details can be found in the Asset Manager documentation.

Flex Objects

Many of the changes and new functionality in Grav 1.6 are related to the new Flex Objects classes we've added. This is a new technology we have been working on that has its origins in Flex Directory along with other ideas and concepts we have been working on for some time. The basic idea behind Flex Objects is to create a set of classes to model data types within Grav. We have been using this technology in custom development projects developed for clients over the past year and a half, and are now moving it into the core of Grav to increase its availability. In this Grav 1.6 release, we have provided an experimental configuration option to use Flex Objects in place of standard Grav users (Flex Users). To the end user, things don't change as the classes are backward compatible, but the developer is now equipped with powerful tools to extend functionality, and also provide a more straightforward UI for management tasks.

Along with these benefits, Flex Objects provide indexing capabilities for enhanced performance with larger data sets, along with granular caching and object-specific Twig templates. Another benefit is powerful collection support for rich querying. The goal is to slowly move core functionality over to Flex Objects so that Grav becomes a more powerful development platform to enhance extensibility and improve performance when scaled. We expect to fully flesh out User support built on top of Flex Objects in Grav 1.7, and perhaps move Themes, and Plugins objects to Flex in that same release. Ultimately, Grav 2.0 will be released with full Flex Object powered pages support.


Learn Redesgin

I wanted to have a quick word about documentation. As part of the Grav 1.6 release, we have entirely redesigned our documentation. We have developed a new theme that like our Quark default theme, is based on Spectre.css Framework. It is better optimized for readability on all devices and has a more appealing modern design. However, the most significant update that we have made is adding support for a version changer to allow switching to the version of docs that more directly relates to your version of Grav.

Interestingly enough, the version functionality is powered by Grav's native mutli-language support where we simply use 15 and 16 as our available languages. This combined with a new [version=x][/version] inline shortcode ensures we can provide entire pages for a specific version, or simply specific sentences or pargraphs.