Quick Start Kit

This kit contains all of the files and the basic project structure to get started with a new SmartDB project.

Browse the QuickStart Source On GitHub: https://github.com/cirkuitnet/PHP-SmartDB/tree/master/samples/quickstart

Download Now

Note - These files are included with the SmartDB framework already. As a convenience, you can download this ZIP, unzip the files into your project's root folder (or wherever you want, really), and follow the steps listed in "Before You Begin"  (below) to configure your project.

Download the ZIP: quickstart.zip

Get the latest SmartDB Framework from the Download Page

If you do not have the SmartDB Framework centralized at a place where multiple projects can access it (recommended), you'll probably want
to unzip the framework within the "include" directory (from quickstart.zip) for your current project. (See Step 2 of "Before You Begin" below)

 

Before You Begin - Customize Your Project

After you have the quick-start files unzipped, you are going to need to customize them for your project:

  1. Update the 'database/db.xml' XML file. This schema defines the database structure of your application.
    • Add/edit tables, columns, and foreign keys as needed. You can always tweak these as you work.
    • See Overview and Basics for specifics on this XML file.
  2. Update 'include/include.php' as follows:
    • Set $smartDbPath and $dbManagerPath to the locations of the SmartDB Framework's SmartDatabase class and a DbManager.
    • Set $db_server, $db_username, $db_password, and $database_name for your database connection.
      • Note - the user and database should already exist! Contact your database admin if you need credentials.
      • Make sure this 'include/include.php' file is secure and not world-readable! Keep your credentials safe.
  3. Execute 'include/_sync.php' to sync your database schema to the actual backend database.
    • Anytime you make a change to your 'database/db.xml' xml file, you should re-sync with your backend database.
  4. Update/rename/edit/delete 'include/MyObject1.php' and 'include/MyObject2.php'
    • You should have 1 include file/class for each table defined in your 'database/db.xml'XML schema.
      • If you have tables "Customer", "Invoice", and "Transaction", you should have 3 of these files created: "Customer.php", "Invoice.php", and "Transaction.php". These names should match the class name you have set in your 'database/db.xml' XML schema. Ex: <Class Name="Customer"> (so the autoloader will work!)
      • Each of these files should contain classes named the same as in your 'database/db.xml' XML schema. Ex: <Class Name="Customer"> (namespaces are supported)
    • You should edit these quick-start classes. The TableName constants will need to be set to your table names, and these classes have some basic example functionality in them that should be altered or removed.

See index.php as a starting point for developing your SmartDB application