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/model, which improves flexibility and reuse of components. A front end controller and static router has been added to allow custom URL schemes. 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 has been 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 (requires a Google Maps API key).
- Simplified the theme and template system down to two components (main layout plus a variable page template). Themes, templates and layout files can be dynamically assigned, giving great flexibility in presentation.
- Data validator class split into a series of smaller traits that are used as required.
- Admin-side search to locate 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 times faster 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.
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:
Note that the installation directory has been changed to /install rather than /installation.
Anything else coming?
Yes, but not for a while. Some thoughts:
- 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).
- Session security will be remodeled to use a login token, which arguably offers a small security benefit (login forces logout of any other active sessions associated with the same user).
- 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 will also be developing some microcontroller-based sensing stations in parallel.
- File integrity / tamper checking mechanism.
- Evaluating the possibility of using the SQRL protocol as an alternative login system.
What about Tuskfish 1?
I won't develop Tuskfish 1 any further (other than security patches, if any issues arise). However, it remains a fast and reliable system, and it is easier to hack due to its simpler architecture.
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, entirely my own fault.