Download the PHP package pixxel/dbal without Composer

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

Pixxel Dbal

This is a simple wrapper for PDO, since we hate its syntax and decided to sugar it up a bit with a simple class. Maybe we extend it in the future, but for now it serves its intended purpose (also, it's mysql only for now, but that will change).

INSTALLATION

A simple example to read from a table called pages(with manual installation / no composer):

require_once(__DIR__.'/Pixxel/Dbal.php');

$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');
$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');

The same example install and usage with composer:

From the terminal (in the desired directory): composer require pixxel/dbal

Then, in that directory, create a php file and use this code:

require_once(__DIR__.'/vendor/autoload.php');

$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');
$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');

As you can see, its mostly normal sql, but without all the things around no one can remember like pdo connection strings and stuff with statements. Note that we always use prepared statements, so make sure that you use its biggest advantage, e.g. pass potentially vulnerable content as parameters:

$singlePage = $dbal->read('select * from `pages` where `id` = :id', [':id' => 5]);

This way you do not have to worry about sql-injection when passing in parameters that the user has control of. Here is a brief summary of what you can do with this class:

1.) Create a PDO connection:

$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');

2.) Select data:

$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');          // Return array containing objects
$pages = $dbal->readSingle('select * from `pages` limit 1 order by `id` desc');     // Return a single object, regardless of how many rows the query returns

3.) Insert, update or delete data:

$dbal->save('insert into `pages` (`title`, `content`) values (:title, :content)', [':title' => 'New page', ':content' => '<h1>Title</h1><p>My content</p>']);

4.) Get the id of the last inserted row:

$dbal->lastInsertId();

5.) Get the last sql error (for debugging purposes):

$dbal->lastError();

6.) Get the last executed query (or has been tried to execute):

$dbal->lastQuery();

That's all for now!


All versions of dbal with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.4
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 pixxel/dbal contains the following files

Loading the files please wait ....