Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
366 lines (235 sloc) 9.5 KB

Quick Start

Connecting and doing a query:


DALMP is the name of the namespace

Will output something like:

DALMP\Database takes the parameters from a DNS (database source name) so before you can start using it you need to define this values.

DSN format


When using Unix domain sockets:

  • Notice that the path of the socket is using backslashes.

Will be translated to:

.. seealso::

   `Unix sockets vs Internet sockets <>`_

DSN Cache format

type:Memcache, Redis, Disk.
host:The host of the Memcache, Redis server.
port:The port of the Memcache, Redis server.
compression:To use or not compression, only available for memcache.
.. seealso::

   DALMP\\Database `Cache method </en/latest/database/Cache.html>`_.

Common methods

The next table contains, 5 common methods for retrieving data:

Name Normal Prepared Statements Cache Normal Cache Prepared Statements
all GetAll PGetAll CacheGetAll CachePGetAll
assoc GetAssoc PGetAssoc CacheGetAssoc CachePGetAssoc
col GetCol PGetCol CacheGetCol CachePGetCol
one GetOne PGetOne CacheGetOne CachePGetOne
row GetRow PGetRow CacheGetRow CachePGetRow

For Inserting or Updating, you can use the Execure or PExecute methods.

.. seealso::

   `Prepared statements </en/latest/prepared_statements.html>`_.

DALMP Classes

For better code maintainability, DALMP is formed by different classes, the main class and the one that does the abstraction layer is DALMP\Database.

mysql DALMP\Database
cache DALMP\Cache
queue DALMP\Queue
sessions DALMP\Sessions


DSN values


If you wan to use the system default charset the DSN would be:

  • notice the mysql:// instead of the utf8://


If you want to use SSL, an array containing the SSL parameters must be passed as the second argument to the database method example:

The $ssl array argument, must follow this format:

key:The path name to the key file.
cert:The path name to the certificate file.
ca:The path name to the certificate authority file.
capath:The pathname to a directory that contains trusted SSL CA certificates in PEM format.
cipher:A list of allowable ciphers to use for SSL encryption.


When using SSL, PHP OpenSSL support must be enable for this to work.

To check that your connection has SSL you can test with this:

If you have SSL you will get something like:


Example using a socket

Example using cache (memcache)

Example using DSN cache (redis)

.. seealso::

   `DALMP Examples <>`_