There are various small PHP classes available within the /src/libc/ directory, which allow various important components / libraries of Apex to be statically accessed. For example:
In the above example it appears we are accessing the methods statically, but in reality we are not. All three classes were created by and retrieved from the dependency injection container, using the classes defined within the bootstrap configuration file (see below). The small /libc/ classes simply relay the calls to the proper PHP classes non-statically, providing for greater simplicity and accessibility, while still utilizing the power and flexibility of dependancy injection.
The below table lists all libraries available within the main Apex platform. Please note, installed packages may offer additional libraries other than those listed below.
Bootstrap Configuration Files
The /bootstrap/ directory contains one PHP configuration file for each of the different request types (http, cli, test), and defines the exact PHP classes to load for each service. For example, if you wanted to switch to the monolog log handler, or a different database driver, you would do so within these configuration files. For another example, the emailer service is changed in the test.php script to a different PHP class that instead of sending the e-mail messages via SMTP, it returns them to the unit test for assertion testing.
Please take a look at the existing configuration files to see how they are formatted, but they are quite straight forward. They simply return one associative array, the keys being the interface / class name (key within the container), and the value being an array defining the PHP class to load.
Need a Professional?
Need development work by the creator of Apex? E-mail firstname.lastname@example.org for a free consultation.
Subscribe to the low traffic mailing list to stay updated on Apex.