Download the PHP package hypnokizer/database without Composer

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

Database class

This class exists to quickly and easily execute perpared queries using the PDO wrapper for an SQLite3 database.

Basic Use

Instantiate the object. If the database file does not exist, it will be created. It should have an extension of *.db. The directory and the file itself should be fully writeable.

The only parameter is an array containing database credentials. The default values are variables defined in an include file, but you can overwrite them for each instance. A try/catch block is used to set up the connection and will throw an error if the database cannot connect.

The run() method is the main method used. It executes the query and stores the values within class properties which can be accessed by the user.

Simple Query

There are (2) parameters. The first, and only required, parameter is the query. Simple queries can be executed like this:

Prepared Statement

To include user input, prepared statements are required. The params variable contains the data to bind to the ? placeholders.

Results

The results from SELECT queries are stored in a multidimensional array called results. Each record is an associative array. This can be accessed with a foreach() loop.

Depending upon the type of query executed, there are several values stored in class properties:

Property Description
lastID The last ID assigned to an insert query
naffected The number of rows affected by a query
nrows The number of rows returned by a query
status Boolean value showing if the query was successful or not

Creating a CSV File

There is also a method to create a CSV file from the record set. To do this, you must first execute the query by calling the run() method. Rather than step through the results array, you have the option of calling the createCSV() method.

The method takes one parameter, which is a filename, including extension.

Debugging

There are two methods used for debugging. The showResults() method shows a summary array for the query. The showObject() method shows the entire PDO object. These methods can be called at any point in the script.


All versions of database with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 hypnokizer/database contains the following files

Loading the files please wait ...