Download the PHP package gp/dbms without Composer

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

GP DBMS Library

The GP DBMS Library is a database management system written in PHP. It provides tools for interacting with databases, managing models, querying data, and handling relationships. The library is designed to make database interaction easier and more efficient.

Table of Contents


Requirements


Installation

You can install gp_dbms using Composer. Run the following command in your terminal:


Getting Started

After installation, you can start using the package by including the autoloader:


Features

Clasess

DBQuery

The DBQuery class is a versatile and extensible query builder designed for database operations. It provides methods to build SELECT, INSERT, UPDATE, and DELETE queries with various features like joins, where conditions, ordering, grouping, and more. This class is meant to be extended by specific database drivers.

Methods Documentation

Core Methods Method Description
select(...$columns): DBQuery Builds the SELECT query with the specified columns.
insert(string $table, array $fields, array $funcfields = []): DBQuery Constructs the INSERT query.
update(string $table, array $fields, mixed $where = null, ?string $join = null): DBQuery Builds the UPDATE query.
delete(string $table, mixed $where = null): DBQuery Creates the DELETE query.
where(array|string ...$args): DBQuery Adds AND conditions to the query.
orWhere(array|string ...$args): DBQuery Adds OR conditions to the query.

Helper Methods Method Description
getQuery(): string Returns the constructed query string.
getBindValues(): array Returns the bind values for prepared statements.
reset(): void Resets the query state.

Notes


Database

The Database class is an abstract superclass designed to serve as the base for all database-related operations. It provides foundational methods for query building, query execution, and transaction management across various database drivers. All driver-specific classes should extend this class and implement the abstract methods to provide database-specific functionality.

Methods Documentation

Core Methods Method Description
query(string $query, array $bindValues = []): bool Executes a raw SQL query with optional bind values.
execute(): bool Executes the previously built query using DBQuery.
set(string $name, string $value): bool Sets a SQL variable.
begin(): bool Starts a transaction.
commit(): bool Commits the current transaction.
rollback(): bool Rolls back the current transaction.
getOne() Fetches a single row from the result set.
getAll() Fetches all rows from the result set.
setQuery($query) Sets a custom query.
setDbQuery($dbQuery) Sets the DBQuery object.

Abstract Methods (To Be Implemented by Drivers)

Method Description
close() Closes the database connection.
runQuery(string $sql, array $bindValues = []): bool Executes a query and returns a success flag.
executeQuery(): bool Executes the previously built query and stores the result.
fetch() Fetches a single row from the result set.
getInstance(string $host, string $user, string $pass, string $db, array $configs = []): Database Retrieves a singleton instance of the database driver.
insertId(): int Returns the ID of the last inserted row.
escape(string $value): string Escapes a string for safe usage in queries.

Properties

Property Description
$con Holds the database connection object.
$result Stores the result set of a query.
$dbQuery Instance of the DBQuery class for query building.
$query Contains the executed query string.
$bindValues Holds the bind values for the query.
$instance Singleton instance of the database class.

Notes

Model

The Model class is an abstract base class for all database models. It provides methods for common ORM operations such as creating, reading, updating, and deleting records. It also includes support for handling relationships through HasMany and HasOne relations.

Methods Documentation

Method Description
save($_is_dirty_update) Saves the model. Inserts a new record or updates an existing one.
delete() Deletes the model based on its unique key.
find($_identifier) Finds a record by its unique identifier.
findAll($_query) Finds all records matching the query.
insert($_data) Inserts a new record into the database.
update($_data, $_where) Updates an existing record in the database.
toDbRow() Converts the model to a database row format.
fromDbRow($_data) Loads the model from a database row.
setDbQuery($query) Sets the DBQuery instance for the model.
triggerEvent($_event) Triggers an event such as beforeSave, afterSave, etc.
getUniqueId() Returns the unique key and its value for the model.
getTableName() Returns the name of the database table associated with the model.

Notes

Events

The Events class in the ORM system is an abstract class that defines constants for various lifecycle events and provides a mechanism for handling these events. It is primarily used to trigger specific actions during the lifecycle of a model, such as before or after saving, deleting, loading, inserting, or updating.

Methods Documentation

Constant Description
EVENT_BEFORE_SAVE Triggered before a model is saved.
EVENT_AFTER_SAVE Triggered after a model is saved.
EVENT_BEFORE_DELETE Triggered before a model is deleted.
EVENT_AFTER_DELETE Triggered after a model is deleted.
EVENT_BEFORE_INSERT Triggered before a model is inserted into the database.
EVENT_AFTER_INSERT Triggered after a model is inserted into the database.
EVENT_BEFORE_UPDATE Triggered before a model is updated.
EVENT_AFTER_UPDATE Triggered after a model is updated.
EVENT_BEFORE_LOAD Triggered before a model is loaded from the database.
EVENT_AFTER_LOAD Triggered after a model is loaded from the database.
Abstract Method Method Description
handle(Model $_model) Handles events for a given model. Must be implemented in derived classes.



Usage

FrameQueries

Select Query

Insert Query

Update Query

Delete Query


Running Queries


Transaction Management

Creating custom DB Driver

Creating an ORM Model

Performing CRUD Operations with ORM Model

Handling Relationships

HasMany
HasOne

Creating Event

Creating and Loading ORM Models with Relations

Example

Contributing

Contributions are welcome! If you would like to contribute to gp_validator, please follow these steps:


License

This package is licensed under the MIT License. See the LICENSE file for more information.


Contact

For questions or issues, please reach out to the development team or open a ticket.


Author



All versions of dbms with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
gp/loader Version ^2.0.10
gp/validator Version ^1.0
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 gp/dbms contains the following files

Loading the files please wait ....