retamayo/tablemancer

一个用于高效数据库表管理的PHP库,包括CRUD操作、JSON数据处理和安全特性。

v1.0.0 2023-08-26 13:32 UTC

This package is auto-updated.

Last update: 2024-09-26 17:05:16 UTC


README

Tablemancer是一个用于简化数据库表管理的PHP库。它提供了处理CRUD(创建、读取、更新、删除)操作、处理JSON数据以及在数据库交互中保持安全性的基本工具。

特性

  • CRUD操作:轻松地在数据库表中创建、读取、更新和删除记录。

  • JSON数据处理:无缝管理JSON数据,方便处理复杂结构化数据。

  • 安全:Tablemancer包括安全措施,以防止常见漏洞,确保数据安全。

要求

  • PHP 8.0或更高版本

安装

您可以使用Composer安装Tablemancer

composer  require  retamayo/tablemancer

使用方法

以下是一个如何使用Tablemancer在数据库中创建新记录的快速示例

<?php

require  'vendor/autoload.php';

use Retamayo\Tablemancer\Facade;
use Retamayo\Tablemancer\Table;

// Create a database connection (replace with your own connection)
$pdo = new  \PDO("mysql:host=localhost;dbname=mydatabase", "username", "password");

// Initialize Tablemancer
$tablemancer = new  Facade($pdo);

// Create a new Table Object
$tableInstance = new  Table(
    name: 'tableName',
    columns: [
        'name',
        'age'
    ],
    primary: 'id',
    sensitive: []
);

// Add the new Table object to the Schema class.
$tablemancer->addTable('tableName', $tableInstance);

// Create a new record on the database.
$tablemancer->create('tableName', ["name" => "tablemancer", "age" => "100"]);

有关更多详细信息和示例,请参阅文档或探索代码库。

许可证

Tablemancer是开源软件,根据MIT许可证发布。

贡献

欢迎贡献!如果您遇到问题或有改进建议,请打开问题或提交pull请求

联系

如果您有任何问题或需要帮助,可以通过rosas.emerjoe.tamayo@gmail.com与我联系。

编码愉快!