How is Nette Versioned in the Post-Monolithic Era?

3 years ago by David Grudl  

Although Nette originally started as a monolith, meaning one large library, it was split into 20 independent libraries in 2014. This became possible with the advent of Composer. Users have increasingly benefited from this change. Many components are now used entirely independently, and some programmers don't even realize they are part of the framework. For example, the PHP code generator Nette PhpGenerator or the mailer Nette Mail. And, of course, essential libraries like Latte and Tracy are part of this.

Each in Its Own Home

Today, each library has its own repository, issue tracker, pull requests, release notes, etc. This is a natural state, just like websites reside on their own domains or each project has its own directory on the disk. Conversely, a tracker that mixes issues related to the development of a CSS preprocessor with writing documentation for a JSON parser, just because both projects were once started by the same programmer, represents the essence of unusability for both users and developers.

Each library also has its own lifecycle. Some libraries are very active (four major versions of Latte were released in 2020), while others are essentially complete and only get updated for new PHP versions (e.g., RobotLoader). This is, again, a natural state of things.

Conversely, forcing these lifecycles together would be unnatural. Tagging a new version of RobotLoader with each release of any Nette library would eventually lead to “major” versions of RobotLoader that don't differ from each other at all. This would not only be against common sense but also against the meaning of versioning. Antisemantic versioning.

Managing various libraries in one repository with one issues tracker and versioning is like cooking several different dishes in one pot.

Common Line

The independent existence of individual libraries means there is no single common version. The latest PhpGenerator is version 3.5, while the new Nette Schema is only 1.1. So what does it actually mean when a “new version of Nette” is released? And how do you update to such a version?

The library with a special status in Nette is Nette Application. When you say you use the Nette Framework, you primarily mean using presenters and thus the Application. And when its version 3.1 is now released, we also talk about the release of Nette 3.1. This, of course, includes other optional compatible packages that naturally have different versions. The fact that they are compatible is not given by the same version number, but by parameters in the composer.json files.

For software packages where there is no hegemonic library, you can use the year. Adobe does this, for instance. So Adobe Creative Cloud 2021 includes Photoshop 22, Illustrator 25, Premiere Pro 14.7, etc. If I am a user of a specific product, I naturally follow its own development and versioning; if I use the entire suite, individual versions cease to matter. The same view can be applied to Nette.

How to Install Updates?

You can update the versions listed in the composer.json file to the latest using the composer require command. And you don't have to search for version numbers at all.

If you use the metapackage nette/nette, by using composer require nette/nette, you will update the version in composer.json to ^3.1 and install all other libraries. If you have a list of individual packages in Composer, which is probably more common, you need to list them all in the command line:

composer require nette/application nette/bootstrap nette/forms latte/latte tracy/tracy ...

This is somewhat impractical. Until Composer has a command for this, use the simple script “Composer Frontline” that will do it for you:

php composer-frontline.php

You can even use it to update other libraries by passing a mask as a parameter: composer-frontline.php doctrine/*.

A new version of Nette 3.1 has just been released, so you can expect interesting articles and migration guides very soon.