PHPackages                             hexmakina/crudites - 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. hexmakina/crudites

ActivePackage[Database &amp; ORM](/categories/database)

hexmakina/crudites
==================

PHP/PDO CRUD

0.0.12(3y ago)2297[15 issues](https://github.com/HexMakina/Crudites/issues)[1 PRs](https://github.com/HexMakina/Crudites/pulls)3mitPHPPHP &gt;=7.1

Since Aug 9Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/HexMakina/Crudites)[ Packagist](https://packagist.org/packages/hexmakina/crudites)[ RSS](/packages/hexmakina-crudites/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (16)Used By (3)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b3d54687ce8b36554c6b6275202c3c288162de8d036f7625eb3bea50637589d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4865784d616b696e612f43727564697465732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/HexMakina/Crudites/?branch=main)[![PHP 7.04 Required](https://camo.githubusercontent.com/f63521cc590300927c6f861886420f8b50b6dc4ebe47f4f7d2712e2a9b3b1dc6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342d627269676874677265656e)](https://camo.githubusercontent.com/f63521cc590300927c6f861886420f8b50b6dc4ebe47f4f7d2712e2a9b3b1dc6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342d627269676874677265656e)[![License](https://camo.githubusercontent.com/ba94e2bf455c1828c7b74a507625bb0a0a939fd8b6d02c875b5a1b5f8d67adec/687474703a2f2f706f7365722e707567782e6f72672f6865786d616b696e612f63727564697465732f6c6963656e7365)](https://packagist.org/packages/hexmakina/crudites)[![Latest Stable Version](https://camo.githubusercontent.com/7620b1de4173d8a65c2428745ec8aa427e2bd6c58b66ef9e2af4ef1bfdc6e40c/687474703a2f2f706f7365722e707567782e6f72672f6865786d616b696e612f63727564697465732f76)](https://packagist.org/packages/hexmakina/crudites)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b3d54687ce8b36554c6b6275202c3c288162de8d036f7625eb3bea50637589d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4865784d616b696e612f43727564697465732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/HexMakina/Crudites/?branch=main)

Crudités ?
==========

[](#crudités-)

*"Crudités, it's a cup of carrots sticks"*

**C**reate - **R**etrieve - **U**pdate - **D**elete - **I**ntrospection, **T**ransaction, **E**rrors &amp; **S**chema

```
CRUDITES
C  CRUD
R  Relations
U  Uniques as PK
D  Disable, Don't Delete
I  Introspect & Inspect
T  Transactions and Tracking
E  Errors
S  Security

```

Crudites is a PHP PDO wrapper

Exception
=========

[](#exception)

`CruditeException` extends `\Exception` and is thrown by all Crudites components

Source
======

[](#source)

The Source object stores and validates a DSN (Data Source Name)

Instantiation
-------------

[](#instantiation)

It is created using a DSN string, the constructor will extract and validates all the required information

`mysql:host=localhost;dbname=testdb`
`mysql:host=localhost;port=3307;dbname=testdb`

Exceptions
----------

[](#exceptions)

If the database's name or a proper driver cannot be found, a `CruditesException` is thrown with the message

- `_DSN_NO_DBNAME_`
- `_DSN_NO_DRIVER_`
- `_DSN_UNAVAILABLE_DRIVER_`

Properties
----------

[](#properties)

The object stores

1. The DSN string (constructor parameter)
2. The database name (extracted from the DSN string)

The object validates the driver's name (extracted from DSN string) by calling `\PDO::getAvailableDrivers()`

Methods
-------

[](#methods)

When instantiated, the object provides two methods:

1. `DSN()`, returns the DSN string (string)
2. `name()`, returns the database name (string)

Connection
==========

[](#connection)

The Connection object relies on PDO to connect to a database.

Instantiation
-------------

[](#instantiation-1)

It is created using

1. a DSN string
2. a username (optional)
3. a password (optional)
4. a list of driver options (optional)

Exceptions
----------

[](#exceptions-1)

The DSN string is validated using the Source object, and may throw `CruditesException`A PDO object is created and may throw a `PDOException`

### Default Options

[](#default-options)

```
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, // the one option you cannot change
\PDO::ATTR_CASE => \PDO::CASE_NATURAL,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC

```

**The PDO::ATTR\_ERRMODE is the only option that cannot be overridden**

Properties
----------

[](#properties-1)

The object stores:

1. a Source object;
2. a database name (string)
3. a PDO object

Methods
-------

[](#methods-1)

When instantiated, the object provides the following methods:

### Database related

[](#database-related)

- useDatabase(string name)
- driverName()
- databaseName()

### Query execution

[](#query-execution)

- prepare(string statement)
- query()
- alter()
- lastInsertId(string name)
- errorInfo()
- errorCode()

### Transactions

[](#transactions)

- transact()
- commit()
- rollback()

Database
========

[](#database)

The object represent a SQL database, handles connection and introspection.

Introspection is a two step process:

1. The `INFORMATION_SCHEMA` is queried and FK and UNIQUE constraints are stored in the object properties upon instantiation
2. The table introspection, called inspection, is executed on demand using `inspect(table_name)` and the results are stored in the table cache property. Inspection uses introspection to create a complete representation of a table: fields, data type, defaults &amp; constraints

Instantiation
-------------

[](#instantiation-2)

It is created using a `Connection` object. The connection is stored and the database instrospection is executed.

Properties
----------

[](#properties-2)

- `Connection` object
- Table cache (array)
- List of foreign keys, indexed by table (array)
- List of unique constraints, indexed by table (array)

Methods
-------

[](#methods-2)

When instantiated, the object provides the following methods:

- name(), returns the database name
- connection(), returns the `Connection` object
- inspect(string table\_name), return a Table object

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

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 ~41 days

Recently: every ~106 days

Total

12

Last Release

1330d ago

PHP version history (3 changes)0.0.2PHP &gt;=7.4

0.0.7PHP &gt;=7.0

0.0.8PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20891495?v=4)[HexMakina](/maintainers/HexMakina)[@HexMakina](https://github.com/HexMakina)

---

Top Contributors

[![HexMakina](https://avatars.githubusercontent.com/u/20891495?v=4)](https://github.com/HexMakina "HexMakina (318 commits)")

---

Tags

crudcrud-operationintrospection-querymariadbmariadb-databasemysqlmysql-databasephpphp7sqlphpdatabasemysqlpdocrudselectupdatedeleteinsertdatabase connectionmariasqlintropection

### Embed Badge

![Health badge](/badges/hexmakina-crudites/health.svg)

```
[![Health](https://phpackages.com/badges/hexmakina-crudites/health.svg)](https://phpackages.com/packages/hexmakina-crudites)
```

###  Alternatives

[aura/sqlquery

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

4883.1M37](/packages/aura-sqlquery)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41256.9k7](/packages/atlas-query)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[bentools/where

PHP7.1 Fluent, immutable SQL query builder. Connectionless, framework-agnostic, no dependency.

125.2k2](/packages/bentools-where)

PHPackages © 2026

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