Download the PHP package joomla/database without Composer

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

The Database Package Build Status Build status

Latest Stable Version Total Downloads Latest Unstable Version License

Introduction

The Database package is designed to manage the operations of data management through the use of a generic database engine.

Escaping Strings and Input

Strings must be escaped before using them in queries (never trust any variable input, even if it comes from a previous database query from your own data source). This can be done using the escape and the quote method.

The escape method will generally backslash unsafe characters (unually quote characters but it depends on the database engine). It also allows for optional escaping of additional characters (such as the underscore or percent when used in conjunction with a LIKE clause).

The quote method will escape a string and wrap it in quotes, however, the escaping can be turned off which is desirable in some situations. The quote method will also accept an array of strings and return an array quoted and escaped (unless turned off) string.

In the first case, the title variable is simply escaped and quoted. Any quote characters in the title string will be prepended with a backslash and the whole string will be wrapped in quotes.

In the second case, the example shows how to treat a search string that will be used in a LIKE clause. In this case, the title variable is manually escaped using escape with a second argument of true. This will force other special characters to be escaped (otherwise you could set youself up for serious performance problems if the user includes too many wildcards). Then, the result is passed to the quote method but escaping is turned off (because it has already been done manually).

In the third case, the title variable is an array so the whole array can be passed to the quote method (this saves using a closure and a )

Shorthand versions are available the these methods:

These shorthand versions are also available when using the Database\DatabaseQuery class.

Iterating Over Results

The Database\DatabaseIterator class allows iteration over database results

It allows also to count the results.

Logging

Database\DatabaseDriver implements the Psr\Log\LoggerAwareInterface so is ready for intergrating with a logging package that supports that standard.

Drivers log all errors with a log level of LogLevel::ERROR.

If debugging is enabled (using setDebug(true)), all queries are logged with a log level of LogLevel::DEBUG. The context of the log include:

An example to log error by Monolog

Add this to composer.json

Then we push Monolog into Database instance.

This is the log file:

Installation via Composer

Add "joomla/database": "~3.0" to the require block in your composer.json and then run composer install.

Alternatively, you can simply run the following from the command line:

If you want to include the test sources, use


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.0
joomla/event Version ^3.0
symfony/deprecation-contracts Version ^2|^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 joomla/database contains the following files

Loading the files please wait ....