juanvladimir13/postgres-database
最新稳定版本:v0.1.7
Composer 安装命令:
composer require juanvladimir13/postgres-database
包简介
Conexion native to postgres
README 文档
README
A lightweight native PHP package for interacting with PostgreSQL databases. It provides a simple connection wrapper, an environment variable loader, and an Active Record-style base model for building data-driven applications with minimal overhead.
Features
- Environment Configuration: A minimal
Dotenvclass to securely load database credentials (DB_HOST,DB_PORT,DB_DATABASE,DB_USERNAME,DB_PASSWORD) from.envfiles. - PostgreSQL Connection Wrapper: The
Postgresclass provides static methods to easily execute queries and performinsert,update,delete, andfetchAlloperations using associative arrays. - Active Record Base Model: An abstract
Modelclass that simplifies CRUD operations, supporting soft deletes, state management (EDITABLE), and standardized response formats. - Data Type Casting: Built-in support for mapping request payloads to specific data types (int, float, string, boolean, utf-8, etc.) using the
DataTypeconstants.
Directory Structure (src/)
Dotenv.php: Loads database connection settings and generates the PostgreSQL connection string.Postgres.php: Core singleton wrapper over native PHPpg_*functions.Models/Model.php: Abstract class providing high-level data access methods (likesave,find,findAll,delete,restore) to be inherited by your application's entities.Models/DataType.php: Defines constants for data types used in request data extraction and casting.
统计信息
- 总下载量: 106
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-31