Tuskfish 2 Beta is available and it's shiny

Tuskfish 2 is a rewrite of Tuskfish CMS to adopt a strict model-view-viewmodel (+ controller) architecture. You can think of it as traditional MVC except the view is split into a view and a viewModel to abstract the relationship between the view and model, which improves flexibility and reuse of components. A front end controller and static router has been added. With the adoption of namespaces, Tuskfish 2 is now a very modern (if small) PHP application.

So what's new?

  • Strict MVVM(C) architecture.
  • Introduced front end controller with static routing for SEO-friendly, customisable URLs.
  • Inheritance completely removed in favour of composition and dependency injection.
  • Namespaces implemented.
  • Content objects simplified down to a single class.
  • Added a GPS track content type - upload a .kml or .kmz file to automatically generate a Google Map with a route of your travel.
  • Simplified the theme and template system down to two components (main layout plus a variable page template).
  • Data validator class split into a series of smaller traits that are used as required.
  • Admin-side search to locating content you want to edit.
  • Optional Yubikey two-factor authentication updated to Yubicloud protocol V2 (V1 is deprecated).
  • A lot of methods have been refactored and simplified.

Why should I care?

  • It's even faster than before (about 5.5 x using identical content load / this site as a benchmark); the MVVMC architecture greatly improves code separation, which means less code is read on each page load.
  • With adoption of namespaces the code is better organised and easier to work with.
  • Easier to extend. Add a new route and your own MVVMC components to create new functionality without disturbing the existing system.

Installation

PHP 7.2 or higher is required. Follow the usual installation process, but if you install it in a subdirectory (eg. public_html/test/), you need to edit the .htaccess file in the site root and modify the FallbackResource to include the path to your subdirectory (this tells your webserver where to look for the front controller). So:

FallbackResource /index.php

Becomes:

FallbackResource /test/index.php

Note that the installation directory has been changed to /install rather than /installation.

Anything else coming?

  • V2 API docs and developer guide will follow soon. The V1 user manual and installation guide are still mostly relevant.
  • Still some room to consolidate the structure further (mainly with regard to several variations on listable models).
  • Data validator will be made redundant and deprecated.
  • Session security will be remodeled to use a login token, which arguably offers a small security benefit (allows forced logout of all active sessions).
  • Still a few points where dependency injection could be improved.
  • Considering implementation of a block management system, using routes as hooks for block display.
  • IOT data capture: API for collecting data / communicating with remote machines and sensors, plus instrumentation for viewing the data. I've been wanting to develop this for a long time, but refactoring Tuskfish keeps getting in the way. I will also be developing some microcontroller-based sensing stations in parallel.

What about Tuskfish 1?

I won't develop Tuskfish 1 any further (other than security patches, if any issues arise). However, it is fast, reliable and easier to hack due as it has a simpler architecture.

Acknowledgements

I got the idea to rewrite Tuskfish along a strict MVVMC architecture from reading a series of excellent articles about MVC on Tom Butler's programming blog. The front end controller is also based on a study of of articles from his site. Any errors or shortcomings in the implementation are of course, my fault.

1564716247_tuskfish2-beta.zip