Open Menu

Available Services#^ TOP

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!

Public Services
  • Colors\Color

    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.

  • PhpSchool\PhpWorkshop\Output\OutputInterface

    A utility class to print content to the standard output stream. Currently this is the standard out connected to the terminal.

  • PhpSchool\PhpWorkshop\ExerciseRepository

    This is a repository of exercises allowing to retrieve exercises and get information regarding them.

  • PhpSchool\PhpWorkshop\Event\EventDispatcher

    EventDispatcher allows listening to events and inserting verifiers at certain points throughout the verifying/running process.

  • Symfony\Component\Filesystem\Filesystem

    An instance of Symfony\Component\Filesystem\Filesystem allowing to perform simple IO operations.

  • PhpParser\Parser

    An instance of PhpParser\Parser which allows to parse PHP code in to an AST structure.

  • PhpSchool\PhpWorkshop\CodePatcher

    Utility to apply patches to PHP code from Exercises.

  • PhpSchool\CliMenu\Terminal\TerminalInterface

    An implementation of PhpSchool\CliMenu\Terminal\TerminalInterface which allows to retrieve and control the current terminal. For example getting the current terminal width.

  • PhpSchool\PhpWorkshop\MarkdownRenderer

    A utility to render Markdown to a string which should display nicely in a console terminal using ANSI escape sequences to format the output.

  • PhpSchool\PhpWorkshop\UserState

    This object provides access to the list of the exercises the student has completed and the exercise they are currently studying.

  • PhpSchool\PSX\SyntaxHighlighter

    An instance of PhpSchool\PSX\SyntaxHighlighter which highlights PHP code using ANSI escape sequences ready to output on a console terminal.

  • PhpSchool\PhpWorkshop\Factory\ResultRendererFactory

    Add your own renderer for your custom results or replace an existing renderer, with your own implementation.