PHPackages                             nahid/crudx - 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. nahid/crudx

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

nahid/crudx
===========

Crudx is a mysql query handling library based on PHP

v1.0.1(9y ago)6396[1 PRs](https://github.com/nahid/crudx/pulls)Creative CommonPHPPHP &gt;=5.4

Since May 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nahid/crudx)[ Packagist](https://packagist.org/packages/nahid/crudx)[ RSS](/packages/nahid-crudx/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

crudx
=====

[](#crudx)

CRUDX is a PHP based library for mysql query builder. Its easy and simple.

How to install
==============

[](#how-to-install)

To install this package go to terminal and run this command

```
composer require nahid/crudx
```

Usage
=====

[](#usage)

To use this package you have to include it. Include it from composer autoload

```
require_once 'vendor/autoload.php';
```

How to connect
==============

[](#how-to-connect)

You can connect by using this process;

```
use Nahid\Crudx\Crudx;

$config = [
    'host' 		=> 'localhost',
    'user' 		=> 'root',
    'password' 	=> 'your_password',
    'database' 	=> 'database_name',
    'charset' 	=> 'utf8',
    'collation'	=> 'utf8_unicode_ci',
    'prefix' 	=> 'table_prefix',
];

$crud = new Crudx($config);
```

Insert
======

[](#insert)

Its too much important to inserting data in database table when you developing an application. Crudx make easy to inserting data in table. Crudx provide different type of insertion mechanism. First you can insert data with Laravel Eloquent style. Suppose you want to save name, username, email in users table. So what can you do?

```
$user=$crud->table('users');

$user->name='Nahid Bin Azhar';
$user->username='nahid';
$user->email='talk@nahid.co';

$user->save();
```

Its like a piece of cake.

The second procedure. Its traditional way. You may called it CodeIgniter Style. However see how can you inserting data with this way.

```
$data=[
	'name'=>'Nahid Bin Azhar',
	'username'=>'nahid',
	'email'=>'talk@nahid.co'
];

$crud->table('users')->save($data);
```

What do you think? yes its Crudx, make easy development.

You may insert multiple records at once. Yes its true, just see what happend

```
$data=[
	[
	'name'=>'Nahid Bin Azhar',
	'username'=>'nahid',
	'email'=>'talk@nahid.co'
	],
	[
	'name'=>'Naim',
	'username'=>'naim',
	'email'=>'naim@themebucket.net'
	]
];

$crud->table('users')->insertMany($data);
```

Update
======

[](#update)

Making update rocord is so easy.

```
$data=[
	'name'=>'Nahid Bin Azhar',
	'username'=>'nahid',
	'email'=>'talk@nahid.co'
];

$crud->where('id', '=', 1)->save($data);
```

Delete
======

[](#delete)

Sometimes you need to delete record from table. Crudx make it easy. Its just a single command

```
$crud->where('id', '=', 1)->delete();
```

Fetching Record
===============

[](#fetching-record)

Crudx provide you to differents type service to fetching record from table. Suppose you want to get all data of author role from table users

```
$crud->table('users')->where('role', '=', 'author')->all()->result();

//generated SQL String: SELECT * FROM users WHERE role='author'
```

But if you want to add multiple condition with `AND` operator then follow the process

```
$crud->table('users')->where('role', '=', 'author')->where('age','>',17)->all()->result();

//generated SQL String: SELECT * FROM users WHERE role='author' AND age>17
```

you can use `orWhere()` for OR operator and you can also use `whereBetween()` `orBetween()

If you have to fetch specific table column then use `get()` method and pass an array to specify table column

```
$crud->table('users')->where('role', '=', 'author')->get(['name', 'username'])->result();

//generated SQL String: SELECT name, username FROM users WHERE role='author'
```

Join
====

[](#join)

Crudx provide you a simple joining method.

```
$crud->table('posts')->join('users', 'posts.user_id','=', 'users.id')->get(['post', 'name'])->result();

//generated SQL String: SELECT post, name FROM posts INNER JOIN users on posts.user_id=users.id
```

Get last inserted id
====================

[](#get-last-inserted-id)

```
$crud->table('users')->save(['name'=>'Nahid']);
echo $crud->getId();
```

Get last generated query string
===============================

[](#get-last-generated-query-string)

Sometimes you have to need which query string is generated by the last method. Crudx make it easy

```
$crud->table('users')->where('role', '=', 'author')->where('age','>',17)->all()->result();
echo $crud->getQueryString();
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

3578d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3167309?v=4)[Nahid Bin Azhar](/maintainers/nahid)[@nahid](https://github.com/nahid)

---

Top Contributors

[![nahid](https://avatars.githubusercontent.com/u/3167309?v=4)](https://github.com/nahid "nahid (9 commits)")

---

Tags

databaseormmysqlcrudmysqlicrudx

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nahid-crudx/health.svg)

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

###  Alternatives

[ezsql/ezsql

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

86946.7k](/packages/ezsql-ezsql)[jv2222/ezsql

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

87311.3k2](/packages/jv2222-ezsql)[go/db

Database library

6624.1k](/packages/go-db)

PHPackages © 2026

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