PHPackages                             raffaelj/cockpit-tables - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. raffaelj/cockpit-tables

AbandonedArchivedCockpit-module[Database &amp; ORM](/categories/database)

raffaelj/cockpit-tables
=======================

SQL table manager for Cockpit CMS

0.3.1(5y ago)13[7 issues](https://github.com/raffaelj/cockpit_Tables/issues)MITPHP

Since Nov 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/raffaelj/cockpit_Tables)[ Packagist](https://packagist.org/packages/raffaelj/cockpit-tables)[ Docs](https://github.com/raffaelj/cockpit_Tables)[ RSS](/packages/raffaelj-cockpit-tables/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Tables addon for Cockpit CMS
============================

[](#tables-addon-for-cockpit-cms)

**This addon is not compatible with Cockpit CMS v2.**

See also [Cockpit CMS v1 docs](https://v1.getcockpit.com/documentation), [Cockpit CMS v1 repo](https://github.com/agentejo/cockpit) and [Cockpit CMS v2 docs](https://getcockpit.com/documentation/), [Cockpit CMS v2 repo](https://github.com/Cockpit-HQ/Cockpit).

---

Manage SQL tables with one-to-many (1:m) and many-to-many (m:n) relations in [Cockpit CMS](https://github.com/agentejo/cockpit/).

Cockpit is a leightweight, headless CMS. It's internal logic is based on MongoDB - a schemaless database. It has a wrapper to use the same logic with SQLite, but there's no real SQL implementation, yet. When I find the time, I'll test a setup with the new, experimental [SQL Driver addon](https://github.com/piotr-cz/cockpit-sql-driver) from [@piotr-cz](https://github.com/piotr-cz).

The Tables addon adds the functionality, to *manage* a SQL database. Cockpit still needs MongoDB or SQLite for it's internal logic.

This addon needs a lot of cleanup and some restructuring. If you use it in production, be aware of possible structural changes. I can't guarantee for backwards compatibility in this early state. It is not performance optimized for large databases, yet.

This addon is experimental. I wanted to do a lot of code cleanup before publishing it, but I didn't have enough time, yet. If I don't publish it now, it won't happen anytime soon anymore...

Please send me some feedback, if you tested it.

[docs](docs/README.md)

Features
--------

[](#features)

- automatic detection of all available tables in the database
- automatic detection of foreign key relations
- automatic generation of field schema with basic type detection (boolean, number, text, textarea, date)
    - with basic validation detection
        - required (`NOT NULL`)
        - maxlength (`VARCHAR(100)`)
- automatic `LEFT OUTER JOIN` to display 1:m related fields in entries and entry views
- if a m:n relation is detected, an extra field is created with a select field for the related content
- save and delete values to/in related m:n tables
- The automatically generated field schema can be adjusted by changing the field settings, like
    - changing text to textarea
    - make a field required, that wasn't setup as nullable in the database
    - change a relation field to a number field to avoid the automatic join
    - remove a m:n extra field, to avoid displaying it in a m:n helper table
    - ...
- split relation-select field, if the related column contains a lot of rows (optional)
- user and group rights management
- spreadsheet export (ODS, CSV, XLSX)

Features (enhancement, maybe, in the future...)
-----------------------------------------------

[](#features-enhancement-maybe-in-the-future)

- RestApi
- graphical relation manager
- update database schema directly (create new table, add index etc.)
- spreadsheet import

Requirements
------------

[](#requirements)

### Cockpit

[](#cockpit)

see [Cockpit's requirements](https://github.com/agentejo/cockpit/#requirements)

- PHP &gt;= 7.0
- PDO + SQLite (or MongoDB)
- GD extension
- mod\_rewrite enabled (on apache)

### Tables addon

[](#tables-addon)

- PDO
- MySQL version ???
- InnoDB schema for MySQL tables (may function, with different schema, but I didn't test it yet)
- All tables must have a *single* column as primary key, which auto-increments. Choose a name, you want - it's not necessary, to name it `id`.

Installation
------------

[](#installation)

Copy this repository into `/addons` and name it `Tables` or

```
cd path/to/cockpit
git clone https://github.com/raffaelj/cockpit_Tables.git addons/Tables
```

build
-----

[](#build)

install dependencies:

`composer install --no-dev --ignore-platform-reqs`

update dependencies:

`composer update --no-dev --ignore-platform-reqs`

Usage/Configuration
-------------------

[](#usageconfiguration)

- Your database with foreign keys exists already.
- Install [Cockpit CMS](https://github.com/agentejo/cockpit/#installation).
- Copy this addon into Cockpit's addon folder.
- Add your database credentials to Cockpit's config file `/config/config.yaml`.

```
tables:
  db:
    host: localhost
    database: database_name
    user: root
    password: SuperSecretPassword
```

Alternatively you can set the path to a config file.

```
tables:
  db: /path/to/config.php
  # db: /path/to/config.ini
  # db: /path/to/config.yaml
```

If you don't need Cockpit's core modules, disable them in the config:

```
modules.disabled:
    - Collections
    - Singletons
    - Forms
```

Copyright and License
---------------------

[](#copyright-and-license)

Copyright 2019 Raffael Jesche under the MIT license.

See [LICENSE](https://github.com/raffaelj/cockpit_Tables/blob/master/LICENSE) for more information.

Credits and third party resources
---------------------------------

[](#credits-and-third-party-resources)

I reused a big part of the [Collections module](https://github.com/agentejo/cockpit/tree/next/modules/Collections) from Cockpit CMS, which is released under the [MIT License](https://github.com/agentejo/cockpit/blob/next/LICENSE), and modified it. Thanks at [Artur Heinze](https://github.com/aheinze) and to all [contributors](https://github.com/agentejo/cockpit/graphs/contributors).

For exporting spreadsheets, I used [PhpSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet), which is released under the [LGPL 2.1 License](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/LICENSE).

I used a minimalistic PDO wrapper from [phpdelusions.net](https://phpdelusions.net/pdo/pdo_wrapper#static_instance). Thanks @colshrapnel

For a top scrollbar above tables I used the jQuery plugin [jqDoubleScroll](https://github.com/avianey/jqDoubleScroll) from [Antoine Vianey](https://github.com/avianey), which is dual licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php) and [GPL License](http://www.gnu.org/licenses/gpl.html).

For syntax highlighting in the docs, I used [highlight.js](https://highlightjs.org/) ([Github](https://github.com/highlightjs/highlight.js), [authors](https://github.com/highlightjs/highlight.js/blob/master/AUTHORS.en.txt)), which is licensed under the [BSD 3-Clause License](https://github.com/highlightjs/highlight.js/blob/master/LICENSE)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~266 days

Total

2

Last Release

2102d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef4edcadbb34e2b59a6e5320ea13b3e53b8c9d3ba08f4387f479f11cfa7d950b?d=identicon)[raffaelj](/maintainers/raffaelj)

---

Top Contributors

[![raffaelj](https://avatars.githubusercontent.com/u/13042193?v=4)](https://github.com/raffaelj "raffaelj (164 commits)")

---

Tags

mysqlsqlcockpitcrud

### Embed Badge

![Health badge](/badges/raffaelj-cockpit-tables/health.svg)

```
[![Health](https://phpackages.com/badges/raffaelj-cockpit-tables/health.svg)](https://phpackages.com/packages/raffaelj-cockpit-tables)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[catfan/medoo

The lightweight PHP database framework to accelerate development

4.9k1.5M194](/packages/catfan-medoo)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[greenlion/php-sql-parser

A pure PHP SQL (non validating) parser w/ focus on MySQL dialect of SQL

63911.6M82](/packages/greenlion-php-sql-parser)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86946.7k](/packages/ezsql-ezsql)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
