Download the PHP package tigron/skeleton-database without Composer

On this page you can find all versions of the php package tigron/skeleton-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 skeleton-database

skeleton-database

Description

This library is a Mysqli wrapper with an easy-to-use API. Most basic features are taken care of automatically.

Installation

Installation via composer:

composer require tigron/skeleton-database

Howto

Create a database connection:

$dsn1 = 'mysqli://username:password@localhost/database';
$dsn2 = 'mysqli://username:password@localhost/database2';

$db = \Skeleton\Database\Database::Get($dsn1, true); // The second parameter makes this dsn default
$db = \Skeleton\Database\Database::Get();             // returns a connection to dsn1 as this is default
$db = \Skeleton\Database\Database::Get($dsn2);        // returns a connection to dsn2, don't make it default
$db = \Skeleton\Database\Database::Get();             // returns a connection to dsn1

Get a row of the resultset. The resultset should only contain 1 row

$result = $db->get_row('SELECT * FROM user WHERE id=?', [ 1 ]); // Returns one row

Get a column, each element in the array contains the value of a row. The result should only contain 1 row

$result = $db->get_column('SELECT id FROM user', []); // Returns 1 column

Get 1 field result.

$result = $db->get_one('SELECT username FROM user WHERE id=?', [ 1 ]); // Returns 1 field

Get all columns of a give table

$result = $db->get_columns('user');

Insert data into a table

$data = [
    'username' => 'testuser',
    'firstname' => 'test',
];

$result = $db->insert('user', $data); // Inserts a new row

Update a row

$data = [
    'username' => 'testuser',
    'firstname' => 'test',
];

$where = 'id=' . $db->quote(1);
$result = $db->update('user', $data, $where); // Updates a row

Run a query manually

$result = $db->query('DELETE FROM `user` WHERE id=?', [ $user_id ]);

Clear all existing database connections

Database::Reset();

For debug purpose flags can be set to see the queries

\Skeleton\Database\Config::$query_log = false; // (default = false)
\Skeleton\Database\Config::$query_counter = true; // (default = true)

$database = \Skeleton\Database\Database::get();
print_r($database->query_log);
print_r($database->query_counter);

Data quality insurance // Trim data if content is longer than table field \Skeleton\Database\Config::$auto_trim = false; // (default = false)

// Remove from objects properties which don't exist as table columns
\Skeleton\Database\Config::$auto_discard = false; // (default = false)

// Set to null every column which is not given as input and supports NULL values
\Skeleton\Database\Config::$auto_null = false; // (default = false)

All versions of skeleton-database with dependencies

PHP Build Version
Package Version
Requires ext-mysqli Version *
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 tigron/skeleton-database contains the following files

Loading the files please wait ....