PHPackages                             celtak/dog-database - 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. celtak/dog-database

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

celtak/dog-database
===================

A class that allows to use a MySQL database and make calls to this database not through queries but through methods

v1.0.1(7y ago)15MITPHPPHP ^7.1.0

Since Mar 29Pushed 7y agoCompare

[ Source](https://github.com/Celtak/dog-database)[ Packagist](https://packagist.org/packages/celtak/dog-database)[ RSS](/packages/celtak-dog-database/feed)WikiDiscussions master Synced 2w ago

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

Installation
============

[](#installation)

Composer install
----------------

[](#composer-install)

```
composer require celtak/dog-database

```

Documentation
=============

[](#documentation)

Prerequisites
-------------

[](#prerequisites)

```
require __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php';

use Celtak\DogDatabase;
```

Connect to the database
-----------------------

[](#connect-to-the-database)

How to connect to the database?

```
$database = new DogDatabase([
    'host' => 'localhost:8889',
    'dbname' => 'azurWeb',
    'username' => 'root',
    'password' => 'root'
], true);
```

The second parameter is a boolean that allows to display or not the errors.

*A table ("users") in a database*
---------------------------------

[](#a-table-users-in-a-database)

To understand how it works, we will use a table.

Table: users

firstnameoldMélanieRodrigues24AnthonyJones40AudreyJones24Work on a table
---------------

[](#work-on-a-table)

```
$database->setTable('users');
```

Create
------

[](#create)

How to insert new data?

```
// Insert new data

$database->insert([
    ['first', 'Henrique'],
    ['name', 'Rodrigues'],
    ['old', 33],
]);
```

What is the result?

idfirstnameold1MelanieRodrigues242AnthonyJones403AudreyJones244HenriqueRodrigues33Read
----

[](#read)

### *getAll()*

[](#getall)

Read the whole database.

```
$read = $database->getAll();

// All the contents of the database
dump($read);
```

Use filters (where, order by and limit).

**Example 1**

```
$read = $database->getAll([
    'where' => ['name', 'Rodrigues'],
    'orderBy' => 'old',
]);

// Just "Melanie Rodrigues" and "Henrique Rodrigues"
dump($read);
```

**Example 2**

```
$read = $database->getAll([
     'limit' => [1, 3]
]);

// Just "Melanie Rodrigues", "Anthony Jones" and "Audrey Jones"
dump($read);
```

### *getFiels()*

[](#getfiels)

Get some fields.

```
$read = $database->getFields(['name', 'first']);

// We just get the "name" and "first" fields of only "Anthony Jones" and "Audrey Jones"
dump($read);
```

With filters.

```
$read = $database->getFields(['name', 'first'], [
    'where' => ['name', 'Jones']
]);

// We just get the "name" and "first" fields from all the database
dump($read);
```

### *getId()*

[](#getid)

Get by id.

```
$read = $database->getId(3);

// We get the data related to id 3, "Audrey Jones"
dump($read);
```

Update
------

[](#update)

### *update()*

[](#update-1)

Using the required "where" filter.

```
// Modify the first name Henrique by Rik

$database->update(
      [
          ['first', 'Rik']
      ],
      [
          'where' => ['first', 'Henrique'],
      ]
  );
```

### *updateId()*

[](#updateid)

Using the id.

```
// Modify the first name by John and the name by Taylor from id 3

$database->updateId(3,
    [
        ['first', 'John'],
        ['name', 'Taylor'],
    ]);
```

Delete
------

[](#delete)

### *delete()*

[](#delete-1)

Using the required "where" filter.

```
// Delete all data from id 2

$database->delete([
    'where' => ['id', '2']
]);
```

### *deleteId()*

[](#deleteid)

```
// Delete all data from id 1

$database->deleteId(1);
```

Custom query
------------

[](#custom-query)

To read.

```
dump($database->getCustomizedQuery('SELECT * FROM users WHERE id = "10"'));
```

To write.

```
$database->customizedExec('INSERT INTO utilisateurs (name, first, old) VALUES ("Henrique", "Rodrigues", "33")');
```

License
=======

[](#license)

MIT.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

2650d ago

### Community

Maintainers

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

---

Top Contributors

[![Celtak](https://avatars.githubusercontent.com/u/21122976?v=4)](https://github.com/Celtak "Celtak (12 commits)")

### Embed Badge

![Health badge](/badges/celtak-dog-database/health.svg)

```
[![Health](https://phpackages.com/badges/celtak-dog-database/health.svg)](https://phpackages.com/packages/celtak-dog-database)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[getgrav/grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS

15.5k85.4k1](/packages/getgrav-grav)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M465](/packages/pimcore-pimcore)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M398](/packages/drupal-core-recommended)

PHPackages © 2026

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