Here's a short summary of what booting Tempest looks like.
\Tempest\Framework\Application\Kernel
class, the first step is to build the container\Tempest\Framework\Application\Bootstraps
DiscoveryLocationBootstrap
and
DiscoveryBootstrap
) are tasked with setting up and executing
discovery
, which is the mechanism that will scan the whole codebase, and automatically register classes, you can read about it in the
next chapter
.ConfigBootstrap
) is used for loading
config
. For now, loading config happens independent of discovery, but we plan on refactoring that.Tempest provides two applications:
ConsoleApplication
and
HttpApplication
. Their name already suggests the difference between the two. Here's how to boot an application:
$application = $container->get(ConsoleApplication::class)
.$application->run()
to run it.Because kernel bootstrap and application boot are two low-level framework concerns, Tempest offers a class that handles all these steps for you behind the scenes:
\Tempest\Framework\Tempest
.
This is the only line framework users should write to actually boot and run Tempest:
// For console applications: Tempest::boot(getcwd())->console()->run(); // For HTTP applications: Tempest::boot(__DIR__ . '/../')->http()->run();
ConfigBootstrap
will scan all registered
discovery locations
, and search for a folder called
Config/
within each location. All files with
.php
will be registered as config filesapp
or
src
). Another example is the Tempest vendor code itself, living in
vendor/tempest
. For now, it's sufficient to know that Tempest will detect all project code for you based on composer, and scan everything that's contains tempest code.A config file would look something like this:
// app/Config/database.php <?php use Tempest\Database\DatabaseConfig; use Tempest\Database\Drivers\SQLiteDriver; return new DatabaseConfig( driver: new SQLiteDriver( path: __DIR__ . '/../database.sqlite', ), );
Note that project-level config files are
optional
, Tempest loads default implementations if there's no user-specific config file. These default config files are located in
src/Tempest/Framework/Config/
. Whenever you create a new config class on the framework level, you should also add a corresponding config file for it in this location.