Download the PHP package gajus/doll without Composer

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

Doll

Build Status Coverage Status Latest Stable Version License

Extended PDO with inline type hinting, deferred connection support, logging and benchmarking.

Single Parameter Constructor

PDO::__construct is using Data Source Name (DSN) string to describe the connection. PDO DSN implementation does not include user, password and driver options.

Doll instance is described using DataSource object:

Deferred Connection

PDO will establish a connection to the database upon initialization. If application initializes PDO during the bootstrap, but does not execute queries (e.g. request that is served from cache), the connection is unnecessary.

Doll will not connect to the database upon initialization:

The connection is deferred until either of the following methods are invoked:

Default Attributes

Attribute PDO Doll
PDO::ATTR_ERRMODE PDO::ERRMODE_SILENT PDO::ERRMODE_EXCEPTION
PDO::ATTR_EMULATE_PREPARES false true
PDO::ATTR_DEFAULT_FETCH_MODE PDO::FETCH_BOTH PDO::FETCH_ASSOC
PDO::ATTR_STATEMENT_CLASS PDOStatement Gajus\Doll\PDOStatement
Attribute Reason
PDO::ATTR_ERRMODE Enables method chaining.
PDO::ATTR_EMULATE_PREPARES PDO_MYSQL will take advantage of native prepared statement support present in MySQL 4.1 and higher. It will always fall back to emulating the prepared statement if the driver cannot successfully prepare the current query.
PDO::ATTR_DEFAULT_FETCH_MODE More convenient.
PDO::ATTR_STATEMENT_CLASS Required for the extended type hinting implementation.

Values for attributes not in the table do not differ.

Method Chaining

PDOStatement::execute() returns a boolean value indicating the state of the transaction, e.g.

However, if you are using PDO::ERRMODE_EXCEPTION error handling strategy, the output of execute is redundant.

Doll forces PDO::ERRMODE_EXCEPTION error handling strategy, while execute method returns an instance of \Gajus\Doll\PDOStatement. This allows further method chaining, e.g.

Extended Type Hinting

Inline Type Hinting

PDOStatement::bindValue() method allows to set the parameter type. However, the syntax is verbose:

Doll allows inline type hinting:

Doll implementation supports all of the parameter types:

Name Parameter Type
b PDO::PARAM_BOOL
n PDO::PARAM_NULL
i PDO::PARAM_INT
s PDO::PARAM_STR
l PDO::PARAM_LOB

Inferred Type Hinting

When parameter name is "id" or ends with "_id", unless an explicit parameter type is set, Doll will use PDO::PARAM_INT, e.g.

Is equivalent to:

You can explicitly set the parameter type:

You can disable the inferred type hinting:

Parameter Marker Reuse

Using Doll, you can reuse the named parameter markers in your prepared statements, e.g.

The native PDO implementation does not support it. It will raise the following error:

PDOException: SQLSTATE[HY093]: Invalid parameter number

Logging and Benchmarking

Doll supports query and statement execution logging. To enable logging, you need to set \Gajus\Doll\PDO::ATTR_LOGGING attribute to true.

The log output contains the following information about each query:

"execution_duration" and "query" are retrieved from SHOW PROFILES. Doll will automatically run diagnostics every 100 executions to overcome the limit of 100 queries.


All versions of doll with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
psr/log Version 1.0.0
ext-pdo Version *
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 gajus/doll contains the following files

Loading the files please wait ....