Download the PHP package initphp/database without Composer
On this page you can find all versions of the php package initphp/database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download initphp/database
More information about initphp/database
Files in initphp/database
Package database
Short Description InitPHP DataBase (QueryBuilder, DBAL and ORM) Library
License MIT
Informations about the package database
InitPHP Database
Manage your database with or without abstraction. This library is built on the PHP PDO plugin and is mainly used to build and execute SQL queries.
Requirements
- PHP 8.0 and later.
- PHP PDO extension.
Supported Databases
This library should work correctly in almost any database that uses basic SQL syntax. Databases supported by PDO and suitable drivers are available at https://www.php.net/manual/en/pdo.drivers.php.
Installation
Usage
QueryBuilder & DBAL and CRUD
Create
Create Batch
Read
Update
Update Batch
Delete
RAW
Builder for RAW
Working With A Different Connection
This library was developed with the thought that you would work with a single database and connection, but I know that in some projects you work with more than one connection and database.
If you want to work with a different non-global connection, use the connect()
method.
Model and Entity
Model and Entity; are two common concepts used in database abstraction. To explain these two concepts in the roughest way;
- Model : Each model is a class that represents a table in the database.
- Entity : Entity is a class that represents a single row of data.
The most basic example of a model class would look like this.
The most basic example of a entity class would look like this.
Development Tools
Below I have mentioned some developer tools that you can use during and after development.
Logger
If you define a file path as a String; Attempts are made to write into it with file_put_contents()
.
Note : You can define variables such as {year}
, {month}
, {day}
in the filename.
-
You can also define an object with the
critical
method. The database library will pass the log message to this method as a parameter. Or define it as callable array to use any method of the object. - Similarly it is possible to define it in a callable method.
DeBug Mode
Debug mode is used to include the executed SQL statement in the error message. It should only be activated in the development environment.
Profiler Mode
Profiler mode is a developer tool available in v3 and above. It is a feature that allows you to see the executed queries along with their execution times.
To Do
- [ ] A more detailed documentation will be prepared.
Getting Help
If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.
Getting Involved
All contributions to this project will be published under the MIT License. By submitting a pull request or filing a bug, issue, or feature request, you are agreeing to comply with this waiver of copyright interest.
There are two primary ways to help:
- Using the issue tracker, and
- Changing the code-base.
Using the issue tracker
Use the issue tracker to suggest feature requests, report bugs, and ask questions. This is also a great way to connect with the developers of the project as well as others who are interested in this solution.
Use the issue tracker to find ways to contribute. Find a bug or a feature, mention in the issue that you will take on that effort, then follow the Changing the code-base guidance below.
Changing the code-base
Generally speaking, you should fork this repository, make changes in your own fork, and then submit a pull request. All new code should have associated unit tests that validate implemented features and the presence or lack of defects. Additionally, the code should follow any stylistic and architectural guidelines prescribed by the project. In the absence of such guidelines, mimic the styles and patterns in the existing code-base.
Credits
License
Copyright © 2022 MIT License