Download the PHP package jinnguyen/puja-db without Composer

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

puja-db v1.1.0

Puja\Db is an adapter that allow your application access to a databases

Install:

composer require jinnguyen/puja-db

Usage:

require_once 'path/to/vendor/autoload.php';
use Puja\Db\Adapter;
use Puja\Db\Table;

// Load db configures
$configures = array(
    'write_adapter_name' => '[adapter_name_2]', //Optional. Set adapter_name_2 is WriteAdapter

    /**
    Namespace to Driver folder, you can change it to your app, if you want create new Driver
    Default value: \Puja\Db\Driver\
    Currently we have 2 default Drivers: Mysqli, Pdo ( recommend to use Pdo)
    */
    'DriverDir' => '\\Puja\\Db\\Driver\\', // Optional

    /**
        Namespace to Pdo Dns folder, you can change it to your app, if you want create new Dns for Pdo
        Default value: \Puja\Db\Driver\Pdo\Dns\
        Currently we have 3 default PDO Dns: mysql, sqlite, pgsql
    */
    'DnsDir' => '\\Puja\\Db\\Driver\\Pdo\\Dns\\', // Optional

    /**
        Required
        A list of configured adapters.
    */
    'adapters' => array(
        '[adapter_name_1]' => array(
            'host' => '[adapter_name_1_host]',
            'username' => '[adapter_name_1_username]',
            'password' => '[adapter_name_1_password]',
            'dbname' => '[adapter_name_1_dbname]',
            'charset' => 'utf8',
            'dns' => '[mysql|sqlite|pgsql]',
        ),
        '[adapter_name_2]' => array(
            'host' => '[adapter_name_2_host]',
            'username' => '[adapter_name_2_username]',
            'password' => '[adapter_name_2_password]',
            'dbname' => '[adapter_name_2_dbname]',
            'charset' => 'utf8',
            'dns' => '[mysql|sqlite|pgsql]',
        )
    )
);
//Load configures to Adapter, just need load 1 time
new Adapter($configures);

Create Adapters

// create default adapter
$adapter = Table::getAdapter('default'); // get  adapter from $configure[adapters][default]

or $adapter = Table::getAdapter(); // get the first adapter from $configure[adapters]

// create write adapter
$adapter = Table::getAdapter('write'); // get  adapter from $configure[adapters][write]

or $adapter = Table::getWriteAdapter() // get adapter from $configure[adapters][*write_adapter_name*]

Execute
Execute an SQL statement and return the number of affected rows

$num = $adapter->execute('select * from *table* limit 20');
var_dump($num);

Query
Executes an SQL statement, returning a result set as a result resource

$result = $adapter->query('select * from *table* limit 20');
print_r($result->fetch());

Prepare
Prepares a statement for execution and returns a Statement

$stmt = $adapter->prepare('select * from *table* where id = :id and status = :status limit 20');
$stmt->bindValue(':status', 1);
$stmt->bindValue(':id', 10);
$stmt->execute();
print_r($stmt->fetch());

Use SQL builder

// Visit https://github.com/jinnguyen/puja-sqlbuilder for more detail
// Build query
$select = $adapter->select()->from('*table*')->where('id = %d', 1)->limit(10);

$result = $adapter->query($select);
print_r($result->fetch());

From table object

$table = new Table('');
$result = $table->findByCriteria(array('id' => 1));
print_r($result);

All versions of puja-db with dependencies

PHP Build Version
Package Version
Requires jinnguyen/puja-sqlbuilder Version ^1
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 jinnguyen/puja-db contains the following files

Loading the files please wait ....

© 2017 - 2024 Weber Informatics LLC