Download the PHP package irfantoor/database without Composer

On this page you can find all versions of the php package irfantoor/database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package database

Irfan's Database

Create models and/or access your databases with ease and least overhead. A bare-minimum and simple database access.

Installation

Creating a Database object

method: new Database(?array $connection = null)

parameters:

returns: Database object

example:

Connect to a Database Engine

method: connect(array $connection)

parameteres:

returns:

example:

Actions passed to database engine

Executes a raw SQL

method: query(string $sql, array $data = [])

parameteres:

returns:

example:

Inserts a record into a connected database

method: insert(string $table, array $record, array $bind = [])

parameteres:

returns:

example:

Updates an existing record

method: update(string $table, array $record, array $options = [])

parameteres:

returns:

example:

Removes a record from database

method: remove(string $table, array $options)

parameteres:

returns:

example:

Retreives list of records

method: get(string $table, array $options = [])

parameteres:

If limit is an int, the records are retrived from start, if its an array it is interpretted like [int $from, int $count], $from indicates number of records to skip and $count indicates number of records to retrieve.

returns:

array [row ...] containing the array of rows or null if not found

example:

Retreives only the first record

method: getFirst(string $table, array $options = []);

parameteres:

returns:

array containing the associative key=>value pairs of the row or null otherwise

example:

Database Models

NOTE: Currently Models only supports SQLite db

Models use the database and calls as explained above. Since a model is tied to a table, therefore the same calls (of database) apply to a model except that the first prameter of table_name is not present in the methods.

Creating a model

example: Models\Users.php

Model constructor

method: $users = new Users(array $connection)

parameteres:

returns:

Users model object

example:

Retrieves the name of the database file

method: getDatabaseFile()

parameteres: none

returns:

string - pathname of the sqlite file the model is connected to

example:

Prepares a schema of the datbase from model definition and returns it

method: prepareSchema()

parameteres: none

returns:

string - Raw SQL schema, prepared from the definition of schema and indices, which were provided while wrinting the model (ref: Creating a Model), is returned. This schema can be used to create the sqlite file manually.

example:

Deploy the schema

method: deploySchema(string $schema)

parameteres:

throws: Exception - in case of error

returns: nothing

example:

Insert a record

method: insert(array $record, array $bind = [])

parameteres:

returns:

example:

Insert or update a record

This method inserts the record if the record deoes not exist, or updates the existing one.

method: insertOrUpdate(array $record, array $bind = [])

parameteres:

returns:

example:

Update an existing record

method: update(array $record, array $options = [])

parameteres:

returns:

example:

Remove an existing record

method: remove(array $options)

parameteres:

returns:

example:

Retrieve a list of records

method: get(array $options = [])

parameteres:

returns: array or records or null

example:

Retrieve the first record

method: getFirst(array $options = [])

parameteres:

returns:

example:

Verify if a record exists

method: has($options = [])

parameteres:

returns:

example:


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package irfantoor/database contains the following files

Loading the files please wait ....