calderawp / caldera-db
WordPress custom table abstractions
0.2.0
2019-04-22 17:38 UTC
Requires
- php: ^7.2
- calderawp/caldera-containers: ^0.2
- inpsyde/wp-db-tools: ^0.2
Requires (Dev)
- php: ^7.2
- brain/monkey: ^2.2
- mockery/mockery: ^1.2
- phpunit/phpunit: ^7.3
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-10-23 07:24:52 UTC
README
👀🌋 This Is A Module Of The Caldera Framework
-
🌋 Find Caldera Forms Here:
-
🌋 Issues and pull requests, should be submitted to the main Caldera repo.
Install
- Add to your package:
composer require calderawp/http
- Install for development:
git clone git@github.com:CalderaWP/http.git && composer install
Overview
This package provides database table creation and basic queries.
Tables schemas are defined using YAML. As of now, only WPDB integration is available.
Caldera Forms Tables
V1 Tables
V2 Tables
Create Table From Attributes
use calderawp\DB\Factory; use calderawp\interop\Attribute; //id column $attributeData = [ 'name' => 'id', 'sqlDescriptor' => 'int(11) unsigned NOT NULL AUTO_INCREMENT', 'format' => '%d', ]; //name column $attribute2Data = [ 'name' => 'name', 'sqlDescriptor' => 'varchar(256) NOT NULL', 'format' => '%s', ]; //name of table $tableName = 'cf_whatever'; //name of primary key(s) $primaryKey = 'id'; //name of index(es) $indexes = ['name']; //Create factory $factory = new Factory(); //Create Table schema $attributes = [$attributeData, $attribute2Data]; $tableSchema = $factory->tableSchema($attributes, $tableName, $primaryKey, $indexes); //Create table using WordPress' wpdb $table = $factory->wordPressDatabaseTable($tableSchema,$wpdb);
License, Copyright, etc.
Copyright 2018+ CalderaWP LLC and licensed under the terms of the GNU GPL license. Please share with your neighbor.