Skip to main content

Call SwartzDB Class

After including the connect.php file, you can start using SwartzDB by initializing its class.

Default Storage Location

By default, SwartzDB stores data in a folder called /storage/ inside the SwartzDB directory. To use the default storage location, instantiate the class like this:

$sdb = new SwartzDB();

This will create an instance of SwartzDB with storage set to SwartzDB/storage/.

Custom Storage Location

If you want to change the storage location, pass the desired path as an argument when creating the SwartzDB instance:

$sdb = new SwartzDB("/path/to/storage/");
info

When specifying a custom storage path, always include a trailing / at the end. This ensures SwartzDB recognizes it as a folder instead of a file prefix.


Correct Usage:

$sdb = new SwartzDB("/custom/path/to/storage/");

Incorrect Usage (missing / at the end):

$sdb = new SwartzDB("/custom/path/to/storage");

By following this step, you have successfully initialized SwartzDB and configured its storage location.