stdimitrov/orm
最新稳定版本:1.0.13
Composer 安装命令:
composer require stdimitrov/orm
包简介
README 文档
README
A lightweight and flexible PHP library that simplifies database interactions by providing a basic custom ORM (Object-Relational Mapping) layer on top of PDO. Designed for developers who want simple, clean, and efficient access to their databases without heavy frameworks.
Requirements
- PHP 8.4 or higher
- PDO extension enabled
Features
- Automatic model generation from existing database tables
- Support InnoDB and MySQL Cluster
- Simple and intuitive CRUD operations
- Read/Write database connection support
- Automatic mapping between
snake_case(database) andcamelCase(PHP) - Secure queries using prepared statements
- Lightweight and dependency-free (except PDO)
- PSR-12 compliant coding standards
Installation
- Download a latest package or use Composer:
composer require stdimitrov/orm
- Create environment file
.envin the root directory of your project:
DB_HOST=localhost DB_NAME=your_database_name DB_USER=your_database_user DB_PASS=your_database_password DB_PORT_RO=3306 # this is port for read connection DB_PORT_RW=3306 # this is port for write connection MODEL_NAMESPACE=App\Models # Namespace for your models
Basic Usage
- Create task for creating models:
$dir = __DIR__ . '/models'; // Directory where the models will be created new \Stdimitrov\Orm\Tasks\CreateModels()->run($dir);
- Create a repository extending current model:
class UsersRepository extends \App\Models\Users { // Add custom methods here }
Contributing
Contributions are welcome!
Please fork the repository, create a feature branch, and submit a pull request.
Follow PSR-12 coding standards and include relevant tests.
License
This project is licensed under the MIT License.
Support
For issues, please open a GitHub Issue or contact [stdimitrov05@gmail.com].
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-04-29