Console β Interactive Debugging for MODX
Console appeared as a simple way to execute PHP code directly inside an authorized MODX Manager and immediately see the result. The component was published back in 2011 and turned the administrative part of MODX into a kind of interactive working environment for developers.
The practical value of Console is especially evident when working with xPDO and processors. Instead of creating a temporary snippet or a separate PHP file, a developer can execute a query, retrieve an object, call a processor, and view its actual response right in the runtime of a specific site.
This fits well with the modxSite architecture, where application operations are built around processors. Console allows testing these operations independently of the frontend: viewing input data, responses, errors, and the behavior of the current system version.
Therefore, even after many years, Console remains useful when modernizing legacy projects. When a new frontend is built on top of an old backend, it helps to first verify the real behavior of the existing logic, and only then build a new integration layer around it.
History of Code Saving and Loading
The features of saving Console code to files and loading it from files did not appear in the initial version of the component. On August 31, 2015, Sergey Shlokov published an article "[Console] Saving code to a file". In his fork, he implemented saving the current code to a file and subsequently loading the file back into Console.
In the same publication, Sergey specifically noted that earlier, thanks to Ilya Utkin, Console could already save code to $_SESSION. This was a separate, earlier feature and was not directly related to import/export via files.
On September 1, 2015, in the comments to that article, Maxim (pathologic) suggested adding similar saving and loading for MODX snippets. Sergey accepted the idea and implemented it.
On September 3, 2015, he published a separate article "[Console] Saving code to a snippet", announcing that Console could now save and load code both from files and snippets, and a pull request with this improvement had already been sent to Nikolay Lantz.
When reviewing the pull request, Nikolay reviewed the implementation, addressed access rights and security issues of file operations, and significantly redesigned the architecture of this part of the component.
In the Console 2.1.0-beta release published on September 5, 2015, saving and loading code via snippets and files was already included in the official component. At the same time, processors and permission checks were redesigned, refactoring was performed, support for nested directories was added, and the ability to store scripts supplied with the component in files/global was introduced.
Thus, the correct attribution of this feature is as follows: the initial implementation of file import/export was done by Sergey Shlokov; the idea of snippet support was proposed by Maxim and also implemented by Sergey; Nikolay Lantz reviewed the code, significantly redesigned the implementation, and included it in the official Console 2.1.0-beta release. Ilya Utkin is not directly related to file and snippet import/export β his earlier contribution consisted of saving Console code to $_SESSION.
Console is part of the general Fi1osof component ecosystem. A historical description of the component is published on Habr.