Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.96 KB

fLoader.wiki

File metadata and controls

62 lines (46 loc) · 1.96 KB

Table of Contents

fLoader

<<css mode="next" class="sidebar"></css>> (((

Class Resources <<toc></toc>>

 - '''<a href="/docs/fLoader">Class Documentation</a>'''
 - <a href="/api/fLoader">API Reference</a>
 - <a href="https://github.com/flourishlib/flourish-classes/blob/master/fLoader.php" target="_blank">Source Code</a>

<<toc></toc>> )))

The fLoader class is designed to load Flourish class. By default it detects the optimal type of loading to perform based on the server environment. In addition to loading classes, it creates constructor functions for the various Flourish value object classes.

Standard Usage

Loading Flourish should normally be performed by calling the static method ::best().

If an opcode cache (e.g. APC, XCache, etc) is detected, all class file are immediately included. If an opcode cache is not detected, an autoload function is registered via `spl_autoload_register()`.

If you need explicit control over what type of loading is performed, you should call one of the static methods ::eager() or ::lazy() instead.

Constructor Functions

Constructor functions is a term used to refer to functions that simply call the constructor of a class. The functions have the same name as the class, which effectively means that the `new` keyword is not required, and that method calls may be changed off of the constructor.

fLoader automatically creates constructor functions for all value object classes:

 - fDate
 - fMoney
 - fNumber
 - fTime
 - fTimestamp

Detecting Opcode Caches

The static method ::hasOpcodeCache() can be used to create intelligent loading functionality for other code.