calderawp/data-source

Caldera data sourcing

0.2.0 2019-04-22 17:38 UTC

This package is auto-updated.

Last update: 2024-11-23 06:31:27 UTC


README

This package provides a layer between the source of data and consumption. The idea is that if the database and other sources of data have the same interface, it will not matter what database -- or API -- the data comes from.

👀🌋 This Is A Module Of The Caldera Framework

Overview

This is used in the forms package for the database, but not for the REST API, which is a bad smell that needs corrected.

Usage

Install

  • Add to your package:
    • composer require calderawp/http
  • Install for development:
    • git clone git@github.com:CalderaWP/http.git && composer install

Examples

use calderawp\DB\Factory;
use calderawp\interop\Attribute;
calderawp\interop\Collections\Attributes;

$tableName = 'cf_whatever';
$primaryKey = 'id';
$indexes = ['name'];

$tableSchema = $factory->tableSchema([], $tableName, $primaryKey, $indexes);

Testing

  • Run unit tests and integration tests
    • composer tests
  • Run unit tests
    • composer test:unit
  • Run integration tests
    • composer test:integration

License, Copyright, etc.

Copyright 2018+ CalderaWP LLC and licensed under the terms of the GNU GPL license. Please share with your neighbor.