Edit on GitHub
Jump to docs navigation

Internals / Container Service References

Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.0 instead?

Below you'll find a reference for some of the key services and parameters that are accessible via the Bolt application container, i.e. $app.

Remember to see the Debugging section for details on interrogating the state of the application container.


The config service provides access to all the configuration settings from the various .yml files in app/config.

For example, to get the value for homepage_template set in config.yml:


Much more detailed information on this topic can be found in Accessing & Reading Configuration.


The filesystem service is an instance of the Bolt\Filesystem\Manager class, and is used for managing access to Bolt's filesystem abstraction layer.

For more details on using this service, see the Filesystem Layer section.


The storage service is an instance of Bolt\Storage\EntityManager, and is responsible for interaction with the configured database.

Internally, database transaction handling is performed via the db service, an instance of a Doctrine Database Abstraction Layer (DBAL) connection object.

Because of the DBAL, you don't need to worry about whether the site is set up as MySQL, PostgreSQL or SQLite. Just make sure to use SQL/DQL that Doctrine understands.

For more details on using this service, see the Storage Layer section. For more information on how DBAL operates, see the Doctrine's Data Retrieval And Manipulation page.


This is an instance of Swiftmailer.


This service is an instance implementing Bolt\Logger\FlashLoggerInterface.

Use this to set Flash messages, i.e. messages that appear on the current or next page view for the current user, for example:

    $app['logger.flash']->success('Something went A-OK.');
    $app['logger.flash']->info('A neutral message.');
    $app['logger.flash']->error('Something went horribly wrong.');


Instance of Monolog\Logger and implements the PSR-3 logging interface


    $message = 'Login: ' . $request->request->get('username');
    $app['logger.system']->info($message, ['event' => 'authentication']);

Logger calls can be any of:

  • emergency()
  • alert()
  • critical()
  • error()
  • warning()
  • notice()
  • info()
  • debug()

The first parameter is a message string.

The second parameter is the context array, and must contain an event key with a value of any of the following:

  • authentication
  • config
  • content
  • cron
  • deprecated
  • exception
  • extension
  • news
  • nut
  • security
  • storage
  • template
  • translation
  • twig
  • upload


Instance of Bolt\Users. See src/Users.php for details.


The session service is an instance of Symfony\Component\HttpFoundation\Session\Session, and is used to store and retrieve user-specific data between requests.

For details on configuration of the session service, see our section on session configuration.

Symfony's page on Session Management provides more details on the operation of the service.


The cache service is an instance of Bolt\Cache, that implements Doctrine\Common\Cache\FilesystemCache.

For more information on the operation of this service, see the Doctrine Caching page.


This is an instance of Bolt\Extension\Manager used to manage the registration and initialisation of Bolt's extensions.

See the page on Bolt extensions for details.


This is an instance of Twig. A lot more information on this can be found both in the Bolt documentation, as well as on the Twig website:

Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.