How blaze works in the background

Let's imagine you are just visiting yoursite.com/index on your blaze powered website. What will happen now?

1. blaze comes to life

blaze will be initialized and load its components. You normally won't notice any of this.

In this first phase, blaze will also load settings, try to find a file named index.php or index.html and all the activated plugins will be prepared.

2. blaze decides what to do

If blaze finds a file to which the request can be routed, it will decide what to do. Should the page be available for public visitors? If not, is the user logged in? How should errors be handled? Shall the final output be optimized for readabiliy (debug mode) or filesize (production mode)?

3. blaze reads your script

blaze will now start an output buffer and load your script. Your script runs as it normally would, but it will not be output directly but stored in the output buffer temporarily.

4. blaze processes your script

In your script, you possibly might have used blaze. Assets will allready have been processed, other tools like the database component will also already have been in action. But now is the time for blaze to clean up the code. If you configured blaze to beautify your code, it will now clean it all up and indent it properly. If you enabled output compression, blaze will strip all unneeded chars. Some more stuff might happen here.

What to keep in mind?

Whenever you use blaze, you should not be thinking too much about what happens. It should normally work without you worrying. Just keep in mind, that an output buffer is put around your stuff. This may possibly cause unexpected behaviour if you do super special stuff. Normally, you won't notice.