hazaarlabs/example-dbi

Example DBI Application for Hazaar MVC

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Type:project

1.0.2 2021-04-23 12:21 UTC

This package is auto-updated.

Last update: 2024-05-16 05:03:27 UTC


README

To make it easy to get up and running quickly with DBI, we have provided the Hazaar MVC Example DBI Application to serve as a starting point for your development.

Installing with Composer

The best way to create a new Hazaar MVC project is to use Composer. If you don't have it already installed, then please see their documentation for installation instructions.

To create your new Hazaar MVC project:

$ composer create-project hazaarlabs/example-dbi path/to/install

Once installed, you can test it out immediately using PHP's built-in web server:

$ composer serve

This will start the PHP cli-server on port 8080, and bind it to all network interfaces.

Note: The built-in CLI server is for development only.

Getting Started

This example application demonstrates a simple use of the Hazaar\DBI\Adapter class to access a list of contacts in a database. To get started you first need to set up your database connection in the `database.json` configuration file. This is currenty:

{
    "production": {
        "driver": "pgsql",
        "host": "db.example.com",
        "dbname": "hazaar-dev",
        "user": "hazaar",
        "password": "hazaar123"
    },
    "development": {
        "include": "production"
    }
}

Simply change the parameters to suite your database environment. When the application runs it will migrate the database to the latest schema version automatically and insert some test data (this would be removed on a production system).