Download the PHP package stule-ru/modernpdo without Composer
On this page you can find all versions of the php package stule-ru/modernpdo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stule-ru/modernpdo
More information about stule-ru/modernpdo
Files in stule-ru/modernpdo
Package modernpdo
Short Description The source code of the simple PDO library.
License MIT
Informations about the package modernpdo
stule-ru/modernpdo






This repository contains code of ModernPDO, the library for working with databases using PDO.
The library is guaranteed to support the following databases: MySQL, MariaDB, PostgreSQL, SQLite3 and custom PDO.
📝 Table of Contents
- About
- Getting Started
- Usage
- Tests
- Built Using
- Authors
🧐 About
This repository contains code of ModernPDO, a library for working with databases using PDO. There are basic tools for working with databases.
For example, here you can see classes for working with insert, delete, select etc.
You can use the library instead of PDO which makes project development easier.
🏁 Getting Started
Installing
The library uses composer autoloader for including files, so you need to install Composer. If you've never used Composer read the manual. You can install via command line or composer.json.
Using command line
- Run the command
composer require stule-ru/modernpdo
in the console.
Using composer.json
-
Add a require
"stule-ru/modernpdo": "^3.0.0"
to your composer.json. - Run the command
composer install
in the console.
🎈 Usage
- Structure
- Initialization
- Queries
- CRUD
- Table
- Transaction
About Structure
NOTE:
If you want to just use the library and not think about the implementation, use
Everyone else, welcome to hell =)
About Source Code
The source code contains:
- The general classes (Escaper.php, etc.)
- The specific DBMS classes (they are located in /src/Drivers/*)
This allows append code rather than rewrite (ModernPDO and etc.)
So, if you need to, you can extend all general classes to achieve your goals.
The general classes:
- Update and etc.
- In and etc.
- TextField and etc.
- Upper and etc.
- UniqueKey and etc.
- Traits* - traits with shared methods like where(), columns() and etc.
- ModernPDO - base class for working with database (methods exec(), query(), select() and etc.)
- Escaper - base class for escaping values.
- Factory - base class for making new actions, transactions and etc.
- Statement - base class for working with database response.
- Transaction - base class for working with transactions.
The drivers:
- MariaDB.
- MySQL.
- PostgreSQL.
- SQLite3.
About Tests
There are 2 types of tests: Unit.
Initialization Examples
Queries Examples
CRUD Examples
Table Examples
Transaction Example
🔧 Running the tests
There are many tools for testing: Integration/Unit tests (PHPUnit), PHPStan, PSalm and CSFixer.
If you want to start them you need to run composer scripts in terminal
NOTE: You can not start integration tests
Levels
- PHPStan: Level 9
- PSalm: Level 1
Composer scripts
Tests
composer tests
- runs all PHPUnit tests (do not run it)composer i-tests
- runs integration PHPUnit tests (do not run it)composer u-tests
- runs unit PHPUnit testscomposer ca-tests
- defines all tests coverage (do not run it)composer ica-tests
- defines integration tests coverage (do not run it)composer uca-tests
- defines unit tests coverage
PHPStan
composer stan
- writes errors to phpstan-report.xmlcomposer stan-bl
- writes errors to phpstan-baseline.neon
PSalm
composer salm
- writes errors to psalm-report.xmlcomposer salm-bl
- writes errors to psalm-baseline.xml
Coding standards fixer
composer csfix
- fixes coding standards in all PHP files
⛏️ Built Using
Languages
- PHP - version >= 8.1
Utilities
- PHPStan - static analyzer
- PSalm - static analyzer
- PHPUnit - testing framework
- PHP-CS-Fixer - coding standards fixer