In this recipe, we will discover how to get services from the DI container in any part of your application. We will also demonstrate also that even if you do not use Phalcon components, you can still use the DI container because it is already loaded in memory.
To successfully implement this recipe, you need to have a Phalcon application and the Volt engine configured. In our example, we will use a sample application generated by Phalcon Developer Tools. However, you can use any other application that is available to you.
You will also need to have a web server installed and configured for handling requests to your application. Your application must be capable of receiving requests and you should have the necessary controllers and views, as well as a bootstrap
file with a connection to a database. The database should have at least one table.