PHP Classes

PHP DB Connection PDO: Query SQL database with parameters from .env files

Recommend this page to a friend!
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 178 This week: 1All time: 8,737 This week: 69Up
Version License PHP version Categories
db-connection-pdo 1.0.0MIT/X Consortium ...5PHP 5, Databases, System information


This package can query SQL databases with parameters from .env files.

It can establish a database connection using the PDO extension using connection parameters read from a .env configuration file.

The package can also execute several types of SQL queries using prepared statements, and query parameter values passed using arrays.

Currently, it can execute:

- Arbitrary SQL queries

- SELECT SQL queries and return the whole result set in an array

- Check if the database server is accessible by executing a SELECT query that does not return useful results

Innovation Award
PHP Programming Innovation award nominee
July 2022
Number 5
Many PHP applications need to access a database server and execute SQL queries to store and retrieve data in database table records.

If for some reason, the database server is not available for connection, any queries that the applications need to execute will fail with an error that may not be very clear what is the real cause.

This package provides a simple solution to check the availability of the database server.

It executes a dummy SQL query that is not useful for storing and retrieving data from the database server.

It only serves the purpose of checking if the database server is accessible.

Manuel Lemos
Picture of Mateo
  Performance   Level  
Name: Mateo <contact>
Classes: 23 packages by
Country: Peru Peru
Age: ???
All time rank: 20694 in Peru Peru
Week rank: 34 Up1 in Peru Peru Up
Innovation award
Innovation award
Nominee: 10x

Winner: 3x

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file Connection.php Class Class source
  Plain text file Query.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:8,737
This week:69Up