Download the PHP package krubio/perfect-database without Composer
On this page you can find all versions of the php package krubio/perfect-database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package perfect-database
Introduction:
These Database Connection Classes are designed to establish a connection with SQLite, MSSQL, Postgres, MongoDB and MySQL databases. These classes provide a common interface for connecting to different databases using PHP Data Objects (PDO) extension This end user documentation and usage instructions will help you to configure and use the SQLiteConnection and MysqlConnection classes in your PHP project.
Installation
You can install the package using Composer. Run the following command in your project directory:
This will download the package and its dependencies and add the package to your composer.json
file.
Usage
Once you have installed the package, you can use the SqliteConnection and MysqlConnection classes by importing them into your code and creating instances of them. Here is an example:
Note that the vendor/autoload.php
file is required to load the classes from the package using Composer's autoloading feature. If you're not using Composer, you'll need to manually include the files for the classes you want to use.
That's it! You can now use the PDO object returned by the connect
method to interact with your database.
Example:
Configuration:
To establish a connection with a database using these classes, you need to provide a configuration array with the required parameters. The configuration array must have the following keys:
For SqliteConnection:
- 'path': The path to the SQLite database file.
- 'options': An array of PDO options. (optional)
For MysqlConnection:
- 'host': The MySQL server hostname or IP address.
- 'port': The MySQL server port number.
- 'dbname': The name of the MySQL database.
- 'charset': The character set to use for the connection.
- 'username': The MySQL username.
- 'password': The MySQL password.
- 'options': An array of PDO options. (optional)
Note: The configuration array must contain all the required keys. Otherwise, an InvalidArgumentException will be thrown.
All versions of perfect-database with dependencies
ext-pdo Version *