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

ActiveLibrary

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 3d 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 32% 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

2604d 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

[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[laravel/vapor-cli

The Laravel Vapor CLI

31310.7M8](/packages/laravel-vapor-cli)[drupal/core-recommended

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

6939.5M343](/packages/drupal-core-recommended)

PHPackages © 2026

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