Internals / Container Service References
Note: You are currently reading the documentation for Bolt 4.0. Looking for the documentation for Bolt 3.6 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.
Remember to see the Debugging section for details on interrogating the state of the application container.
config service provides access to all the configuration settings from the
.yml files in
For example, to get the value for
homepage_template set in
Much more detailed information on this topic can be found in Accessing & Reading Configuration.
filesystem service is an instance of the
and is used for managing access to Bolt's filesystem abstraction layer.
For more details on using this service, see the Filesystem Layer section.
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.
This is an instance of Swiftmailer.
This service is an instance implementing
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.');
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:
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:
src/Users.php for details.
session service is an instance of
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.
cache service is an instance of
Bolt\Cache, that implements
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: