Download the PHP package apex/db without Composer

On this page you can find all versions of the php package apex/db. 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 db

ADL - Apex Database Layer

A lightweight database layer designed for simplicity and ease of use, providing a middle ground between larger ORMs and base PHP functions (ie. mysqli_*). Supports multiple database engines, object mapping, initialization wrappers for Doctrine and Eloquent, connection load balancing, and an optional wrapper allowing methods to be accessed statically. It supports:

Installation

Install via Composer with:

composer require apex/db

Table of Contents

  1. Database Connections
  2. SQL Database Methods (26 methods)
    1. insert()
    2. update()
    3. insertOrUpdate()
    4. query()
    5. getRow()
    6. getIdRow()
    7. getObject()
    8. getIdObject()
    9. getField()
    10. getColumn()
    11. getHash()
  3. Placeholders
  4. Object Mapping
  5. Additional / Supplemental
    1. SQL Parser for Large SQL Files
    2. Using redis and the Connection Manager
    3. Utilizing Apex Debugger
    4. Db Wrapper for Statically Accessing Methods
    5. Initialization Wrappers for Doctrine, Eloquent, and PDO

Basic Usage

use Apex\Db\Drivers\mySQL\mySQL;

$db = new mySQL([
    'dbname' => 'mydb', 
    'user' => 'myuser', 
    'password' => 'mydb_password'
]);

// Insert a record
$db->insert('users', [
    'username' => 'jsmith', 
    'full_name' => 'John Smith', 
    'email' => '[email protected]'
);
$userid = $db->insertId();

// Get single user by id#
if (!$profile = $db->getIdRow('users', $userid)) { 
    die("No user at id# $userid");
}

// Get single field
if (!$email = $db->getField("SELECT email FROM users WHERE id = %i", $userid)) { 
    die("No e-mail exists for user id# $userid");
}
echo "E-mail is: $email\n";

// Go through all users with @domain.com e-mail
$domain = '@domain.com';
$rows = $db->query("SELECT * FROM users WHERE email LIKE %ls", $domain);
foreach ($rows as $row) { 
    echo "Found: $row[username] - $row[full_name]\n";
}

Object Mapping

Allows mapping to and from objects with ease by simply passing the objects to write methods, and one static call to map results to an object. For example:

use Apex\Db\Drivers\mySQL\mySQL;
use Apex\Db\Mapper\ToInstance;
use MyApp\Models\UserModel;

$db = new mySQL([
    'dbname' => 'mydb', 
    'user' => 'myuser', 
    'password' => 'mydb_password'
]);

// Get users
$rows = $db->"SELECT * FROM users WHERE group_id = 2");
foreach ($rows as $row) {
    $user = ToInstance::map(UserModel::class, $row);
    // $user is a UserModel object, injected and instantiated
}

// Get specific user
$userid = 5811;
$row = $db->getIdRow('users', $userid);    /// $user  is a UserModel object
$user = ToInstance::map(UserModel::class, $row);

// Insert new user
$user = new UserModel($my, $constructor, $params);
$db->insert('users', $user);

// Unsure if inserting or updating?  No problem.
$db->insertOrUpdate('users', $user);

Follow Apex

Loads of good things coming in the near future including new quality open source packages, more advanced articles / tutorials that go over down to earth useful topics, et al. Stay informed by joining the mailing list on our web site, or follow along on Twitter at @mdizak1.


All versions of db with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/string Version ^6.0
doctrine/orm Version ^2.16
illuminate/database Version ^10.28
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 apex/db contains the following files

Loading the files please wait ....