Download the PHP package a-le/microdbal without Composer

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

microDbal

microDbal is a minimal PHP database abstraction layer.
It wraps PDO to give you clean, safe, and simple database access.

🚀 Why microDbal?

💬 If you like microDbal, leave a ⭐ on GitHub — it really helps!

Tested with those Databases

Firebird, MySQL / MariaDB, MS SQL Server, PostgreSQL, SQLite.
Should support any database that is compatible with PHP's PDO.

Installation

Install via Composer:

Or alternatively:
Simply drop MicroDbal.php into your project folder and include it manually.

Usage

Note: SQL must be adapted to your targeted database. The following examples use SQL syntax for SQLite.

1. Autoload with composer

Or alternatively:

2. Connect to the Database


3. Run Queries


4. Get All Rows

Output:


5. Get a Single Row

Output:


6. Get a Single Column

Output:


7. Get a Single Value

Output:


8. Get Affected Rows

Output:


9. Get Last Inserted ID

Output:


10. Get Column Metadata

Output:


11. Transactions


12. Fetch Objects


13. SQL IN Helper


14. SQL LIKE Helper


15. Access the PDO Instance

The underlying PDO instance is exposed as a public property: $db->pdo.
You can use it directly for uncovered operations or to integrate with other libraries that expect a PDO object.

For example, using delight-im/PHP-Auth, which requires a PDO connection:


16. Access the PDO Statement Object

The run method returns a standard PDOStatement object, which you can use as needed — for example, to manually fetch rows one by one:

This gives you full control over result fetching, especially useful for large datasets or custom processing.


FAQ

What happens if there is an error?

Common setups for dealing with PHP errors:

With these configurations:

If you need to recover from an error, you can use a try...catch block to handle the exception and continue the script's execution.

For more information about the rationale behind this approach, see: PHP Delusions - Try Catch


Running Tests

To run tests using PHPUnit:

  1. Clone the repository with composer :

  2. Run tests on SQLite (default to memory DB if no DSN provided) :

  3. Run tests on any database connection :

    Example

Status

First stable version just released (april, 2025).

🤝 Contributing

Contributions are very welcome!
Feel free to open an issue for bug reports, feature requests, or questions.

🛠️ This library aims to remain micro.
If you'd like to submit a pull request, please open an issue or discussion first to make sure it aligns with the project's goals.

License

This project is licensed under the MIT License. See the LICENSE file for details.


All versions of microdbal with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
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 a-le/microdbal contains the following files

Loading the files please wait ...