PHPackages                             yohancayres/crud-advanced - 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. [Admin Panels](/categories/admin)
4. /
5. yohancayres/crud-advanced

ActiveLibrary[Admin Panels](/categories/admin)

yohancayres/crud-advanced
=========================

This class is a Crud with advanced methods. Provides agility and productivity in development. Edit

v1.0(9y ago)011MITPHPPHP &gt;=5.3.3

Since Apr 29Pushed 3y agoCompare

[ Source](https://github.com/yohancayres/crud-advanced)[ Packagist](https://packagist.org/packages/yohancayres/crud-advanced)[ Docs](https://github.com/yohancayres/crud-advanced)[ RSS](/packages/yohancayres-crud-advanced/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Crud-Advanced
=============

[](#crud-advanced)

### This class is a Crud with advanced methods. Provides agility and productivity in development.

[](#this-class-is-a-crud-with-advanced-methods-provides-agility-and-productivity-in-development)

All the methods and a description about them will be listed below. All class Crud.class.php is documented.

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

[](#installation)

### Install Manually

[](#install-manually)

You can install CrudAdanved manually

```
require_once "src/CrudAdvanced/DataBase.php";
require_once "src/CrudAdvanced/Val.php";
require_once "src/CrudAdvanced/Crud.php";

use CrudAdvanced\DataBase;
use CrudAdvanced\Val;
use CrudAdvanced\Crud;
```

### Install with Composer

[](#install-with-composer)

You can install CrudAdanved with composer With command:

```
composer require yohancayres/crud-advanced
```

or adding in composer.json

```
{
    "require": {
        "yohancayres/crud-advanced": "dev-master"
    }
}
```

Available Methods
-----------------

[](#available-methods)

### Generic Methods

[](#generic-methods)

- \_set($key, $value) - Set or change the value of an attribute;
- \_get($key) - Get the value of an attribute;
- loadData(array $data) - Loads data from an array to object attributes;
- requiredParam(array $params) - Checks whether the required attribute exists;
- getParamArray(array $params) - Get an array of object attributes;

### Databases Methods

[](#databases-methods)

- [dbInsert()](#insert-new-user-with-dbinsert) - Inserts the attributes of the object in the database;
- [dbUpdateAll()](#update-some-row-with-dbupdateall-or-dbupdateatts) - Refreshes all attributes in the database;
- [dbUpdateAtts($atts)](#update-some-row-with-dbupdateall-or-dbupdateatts) - Updates specific attributes in the database;
- [dbUpdate($attr, $newvalue)](#update-directly) - Defines and updates the value of an attribute in the database;
- dbUpdateIncrease($attr, $amount) - Updates an attribute by incrementing its value (this value can be negative);
- dbSearch($attr, $data) - Searches the database;
- dbRemove() - Removes a record from the database;
- dbCheckExists($attr) - Checks whether a record already exists;
- dbLoadData($values) - Loads all data from the database;
- [dbLoadDataBy($attr, $values)](#dbloaddataby) - Loads all database data using an attribute defined by the first parameter;
- fetchById($id, $values) - Get database record;
- fetchRandom($values) - Gets a random record of the database;
- fetchAll($where, $loadAtts) - Get all records from the table;

### Relationship

[](#relationship)

- hasOne($className, $thisAttName, $classAttName, $loadAtts)- Creates a one-to-one relationship;
- hasMany($className, $thisAttName, $classAttName, $loadAtts) - Creates a one-to-many relationship;

Examples
--------

[](#examples)

#### Connect to the Database

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

First of all, the application needs information to connect to the database

```
use CrudAdvanced\DataBase;

DataBase::configure('127.0.0.1', 'root', 'password', 'dbteste');
```

#### Using Crud

[](#using-crud)

To create a class and use the Crud Methods, you need to extends Crud to your class.

```
use CrudAdvanced\Val;
use CrudAdvanced\Crud;

class User extends Crud {

	/* Database table definition */
	public $table = "users"; // Define Table name
	public $tableCols = ['name', 'email', 'password']; // Define table cols

	/*
	 * Other class methods and attributes can be defined freely.
	 */
}
```

#### Insert new user with dbInsert()

[](#insert-new-user-with-dbinsert)

This method will insert all the attributes to the database. Be aware of the name of the attributes, they must be exactly the same as the fields in the database.

```
$user = new User([
	'name' => 'Yohan Cayres',
	'email' => 'yohan.cayres@mail.com',
	'password' => md5('somepassword')
]); // Create new object type User

$user->dbInsert(); // Insert at the Database
```

#### dbLoadDataBy()

[](#dbloaddataby)

This method will load attributes from database, making the search for the defined attribute.

```
$user->dbLoadDataBy('email', 'id,name,password'); // Loads a database attribute by email.
echo $user->_get('id');
```

#### Update some row with dbUpdateAll() or dbUpdateAtts()

[](#update-some-row-with-dbupdateall-or-dbupdateatts)

This method needs the id attribute, you can get it through dbLoadDataBy();

```
$user->_set('email', 'newMail@mail.com'); // This will set a new email

$user->dbUpdateAtts('email'); // Only the attribute 'email' will be updated
$user->dbUpdateAll(); // All the attributes will be updated
```

#### Update directly

[](#update-directly)

This method needs the id attribute, you can get it through dbLoadDataBy();

```
$user->dbUpdate('email', 'newMail@mail.com'); // Set and update directly.
```

Hosting Options
---------------

[](#hosting-options)

[Web Hosting](https://hostmf.com.br) [VPS Windows](https://hostmf.com.br/vps-windows) [VPS Linux](https://hostmf.com.br/vps-linux)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5381c846e301020a1c64c1ecdb33748cccf47a6e450f98e3aabeedbc08b36616?d=identicon)[yohancayres](/maintainers/yohancayres)

---

Top Contributors

[![yohancayres](https://avatars.githubusercontent.com/u/26947344?v=4)](https://github.com/yohancayres "yohancayres (37 commits)")

---

Tags

crudyohancayres

### Embed Badge

![Health badge](/badges/yohancayres-crud-advanced/health.svg)

```
[![Health](https://phpackages.com/badges/yohancayres-crud-advanced/health.svg)](https://phpackages.com/packages/yohancayres-crud-advanced)
```

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.4M207](/packages/backpack-crud)[appzcoder/crud-generator

Laravel CRUD Generator

1.4k581.4k7](/packages/appzcoder-crud-generator)[friendsofcake/crud

CakePHP Application development on steroids - rapid prototyping / scaffolding &amp; production ready code - XML / JSON APIs and more

3751.4M25](/packages/friendsofcake-crud)[laravelrus/sleepingowl

Administrative interface builder for Laravel.

810219.6k3](/packages/laravelrus-sleepingowl)[ibex/crud-generator

Laravel CRUD Generator

706235.0k](/packages/ibex-crud-generator)[backpack/pagemanager

Create admin panels for presentation websites on Laravel, using page templates and Backpack\\CRUD.

371522.6k6](/packages/backpack-pagemanager)

PHPackages © 2026

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