There are numerous services exposed via the DI container. The services exposed to user-land code are listed below. These can be used in your exercises, custom-checks and other services you may create as part of your workshop.
There are actually many more services exposed but these are for internal use of the workshop framework only. These services should not be used. If you decide to ignore the advice given here, you should take caution as backwards compatibility breaks may be introduced in minor versions. If you feel a service should be public, contact us and we can discuss it!
An instance of Colors\Color. Use this to apply ANSI styles to strings. For example, to colour a string ready to be printed to the console.
A utility class to print content to the standard output stream. Currently this is the standard out connected to the terminal.
This is a repository of exercises allowing to retrieve exercises and get information regarding them.
EventDispatcher allows listening to events and inserting verifiers at certain points throughout the verifying/running process.
An instance of Symfony\Component\Filesystem\Filesystem allowing to perform simple IO operations.
An instance of PhpParser\Parser which allows to parse PHP code in to an AST structure.
Utility to apply patches to PHP code from Exercises.
An implementation of PhpSchool\CliMenu\Terminal\TerminalInterface which allows to retrieve and control the current terminal. For example getting the current terminal width.
A utility to render Markdown to a string which should display nicely in a console terminal using ANSI escape sequences to format the output.
This object provides access to the list of the exercises the student has completed and the exercise they are currently studying.
An instance of PhpSchool\PSX\SyntaxHighlighter which highlights PHP code using ANSI escape sequences ready to output on a console terminal.
Add your own renderer for your custom results or replace an existing renderer, with your own implementation.