wpdiggerstudio/wpzylos-database
最新稳定版本:v1.0.0
Composer 安装命令:
composer require wpdiggerstudio/wpzylos-database
包简介
Safe wpdb wrapper with query builder for WPZylos framework
README 文档
README
Safe wpdb wrapper with query builder for WPZylos framework.
📖 Full Documentation | 🐛 Report Issues
✨ Features
- Query Builder — Fluent interface for SQL queries
- Safe Queries — Automatic $wpdb->prepare() integration
- CRUD Operations — insert, update, delete, select
- Table Prefixing — Automatic table prefix handling
- Transactions — Database transaction support
📋 Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.0 |
| WordPress | 6.0+ |
🚀 Installation
composer require wpdiggerstudio/wpzylos-database
📖 Quick Start
use WPZylos\Framework\Database\DB; // Simple queries $users = DB::table('users')->get(); $user = DB::table('users')->find(1); // Query builder $products = DB::table('products') ->where('status', 'active') ->where('price', '>', 100) ->orderBy('created_at', 'desc') ->limit(10) ->get();
🏗️ Core Features
Select Queries
// Get all records $users = DB::table('users')->get(); // Get first record $user = DB::table('users')->where('email', $email)->first(); // Select specific columns $names = DB::table('users')->select('id', 'name')->get(); // With conditions $active = DB::table('users') ->where('status', 'active') ->where('role', 'admin') ->get();
Insert
DB::table('users')->insert([ 'name' => 'John Doe', 'email' => 'john@example.com', ]); // Get insert ID $id = DB::table('users')->insertGetId([ 'name' => 'Jane Doe', 'email' => 'jane@example.com', ]);
Update
DB::table('users') ->where('id', 1) ->update(['status' => 'inactive']);
Delete
DB::table('users') ->where('id', 1) ->delete();
Transactions
DB::transaction(function () { DB::table('orders')->insert($order); DB::table('inventory')->decrement('stock', 1); });
📦 Related Packages
| Package | Description |
|---|---|
| wpzylos-core | Application foundation |
| wpzylos-migrations | Database migrations |
| wpzylos-scaffold | Plugin template |
📖 Documentation
For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.
☕ Support the Project
If you find this package helpful, consider buying me a coffee! Your support helps maintain and improve the WPZylos ecosystem.
📄 License
MIT License. See LICENSE for details.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Made with ❤️ by WPDiggerStudio
统计信息
- 总下载量: 278
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-31