Dependency list

Dependencies are variables (mostly objects) which can be passed to listener-classes and controller-classes. Which variables are passed, is defined in .yml files, which are read by the Symfony framework. Dependencies can include services and parameters. For an extension, such a coupled .yml-file and listener-class could look as follows:

services.yml: services: myvendor.myext.listener: class: myvendor\myext\event\listener arguments: - @config - @template - @user - @controller.helper - %core.root_path% - %core.php_ext%

listener.php: class listener implements EventSubscriberInterface {  /**   * Constructor *  * @param \phpbb\config                 $config            Config object * @param \phpbb\template              $template          Template object * @param \phpbb\user                  $user              User object * @param \phpbb\controller\helper     $helper            Controller helper object * @param string                       $root_path         phpBB root path * @param string                       $php_ext           phpEx */  public function __construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, $root_path, $php_ext) {     $this->config = $config; $this->template = $template; $this->user = $user; $this->helper = $helper; $this->root_path = $root_path; $this->php_ext = $php_ext; }

Note that the order of the dependencies must be the same in the arguments-list in services.yml and in the constructor in listener.php. The passing of dependencies in this way replaces the need of using  in most cases.

Overview of dependencies available in phpBB
The table below provides an overview of the most common dependencies used in phpBB. Note that most of these are defined in the .yml files in the config directory which can be found in the phpbb root, most notably the services.yml file.