Download the PHP package vielhuber/dbhelper without Composer

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

build status

🍗 dbhelper 🍗

dbhelper is a small php wrapper for mysql/postgres/sqlite databases.

installation

install once with composer:

then add this to your project:

usage

logging

dbhelper can support setting up a mature logging system on mysql/postgres databases.

setup_logging() does four things:

you should run this method after a schema change (e.g. in your migrations) and you can also run it on a daily basis via cron. it is recommened to exclude blob/bytea columns.

the logging table has the following schema:

we now have to adjust our queries. updated_by must be populated by the web application on all insert/update queries and our logging table must be manually populated before delete queries:

instead of all this we can let dbhelper magically do the heavy lifting on every insert/update/delete for us:

dbhelper then automatically injects the updated_by column on all insert/update statements and inserts a log entry before every delete query (all queries are handled, even those who are sent with $db->query).

important note: if we manipulate data outside of our web application, the triggers also work, except with accurate values in updated_by. this is especially true for delete statements (they also work without the manual insert query upfront).

call the following helper functions, if you (temporarily) need to disable logging by triggers:

that's it – happy logging.

wordpress support

this also works for wordpress (using wpdb, prepared statements and stripslashes_deep under the hood):

locking in sqlite

sqlite is nice but database locking can be tricky.\ dbhelper provides a default timeout of 60 seconds, which prevents most database locks.\ you can manually define a timeout in the connect() function.\ checkout the following sqlite lock tests:

also consider enabling wal via $db->query('PRAGMA journal_mode=WAL;');.

return values

as return values after fetching results dbhelper usually returns associative arrays.\ if you use it with wordpress, objects are returned.\ dbhelper throws exceptions on all occured errors.\ on an insert operation, the primary key (id) is returned.\ on any delete, update or even query operation, the number of affected rows are returned.

static version

here is also a static version with static function calls (this makes sense, if you use a single instance of dbhelper):


All versions of dbhelper with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 vielhuber/dbhelper contains the following files

Loading the files please wait ....