Download the PHP package webservco/database without Composer

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

webservco/database

A PHP component/library. Please see webservco/sandbox for an example project using these types of components.

PDO for MySQL and MariaDB, with a connection that opens on first use, query helpers and transactions.


Installation


Usage

Create the container in a factory. The webservco/sandbox project does it in a module's local container factory, using values from the configuration.

Inject the container (not the PDO object) into storage classes and query through it:

Transactions


Contracts

Interface Implementation Purpose
Contract\PDOContainerInterface Container\PDOContainer getPDO() (shared, opened on first call), createPDO() (new connection), getPDOService().
Contract\PDOContainerFactoryInterface Factory\PDOContainerMySQLFactory Creates the container from connection details.
Contract\PDOServiceInterface Service\PDOService Prepare, fetch, error info, last insert id, placeholders.
Contract\TransactionalDatabaseServiceInterface Service\TransactionalDatabaseService Begin, commit (rolls back if the commit fails) and roll back.
Contract\PDOFactoryInterface Factory\PDOFactory Creates a PDO object with the settings below.

Namespaces are relative to WebServCo\Database\.


Configuration

The component takes plain values and doesn't care what the keys are called. The sandbox project uses:


Notes

Every connection uses utf8mb4, throws exceptions on errors, fetches associative arrays and uses real prepared statements (no emulation). Only the mysql driver is accepted.

Because the container opens the connection on first use, a long-running script doesn't hold an idle connection that the server may close ("MySQL server has gone away").

fetchAssoc() returns [] when there are no more rows. generatePlaceholdersString($values) returns ?,?,? for an IN (...) list. isRecoverableError() is true for a deadlock or a lock wait timeout. Retry those.


Development


License

MIT


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
webservco/data Version ^0
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 webservco/database contains the following files

Loading the files please wait ...