Skip to content

Installation

Erik Thiart edited this page Oct 2, 2023 · 1 revision

Installation

Prerequisites

Before you can start using DBease in your PHP project, ensure that you have the following prerequisites installed:

  1. PHP: DBease requires PHP 7.0 or later to function correctly. You can download and install PHP from the official PHP website: php.net.

  2. MySQL Database: Make sure you have access to a MySQL database where you intend to use DBease for your database interactions.

Installation via Composer

The recommended way to install DBease is by using Composer, a popular PHP package manager. Follow these steps to install DBease in your project:

  1. Create a new PHP project or navigate to an existing one.

  2. Open your terminal/command prompt and navigate to your project's root directory.

  3. Run the following command to add DBease to your project's dependencies:

composer require erikthiart/dbease
  1. Composer will download and install DBease along with its dependencies.

  2. Once the installation is complete, you can start using DBease in your PHP code.

Manual Installation

If you prefer not to use Composer, you can manually install DBease by following these steps:

  1. Download the latest release of DBease from the GitHub releases page.

  2. Extract the downloaded archive to your project's directory.

  3. Include the Database.php file in your PHP code by adding the following line at the beginning of your script:

require_once 'path/to/Database.php';

Replace 'path/to/Database.php' with the actual path to the Database.php file.

  1. You can now start using DBease in your PHP code.

Verify Installation

To verify that DBease is correctly installed in your project, you can create a simple PHP script that initializes the Database class and connects to your database. If no errors occur during this process, the installation is successful.

Here's a minimal example:

<?php
require_once 'path/to/Database.php';

// Create a new Database instance
$db = new \Core\src\Database();

// Replace the above line with the actual path to 'Database.php'

// Perform a simple database query (e.g., retrieve a record)
$data = $db->find('your_table_name', ['id' => 1]);

// Display the result
var_dump($data);
?>

Replace 'your_table_name' with the name of a table in your database.

That's it! DBease should now be successfully installed and ready to use in your PHP project.

Clone this wiki locally