PHPackages                             a\_nameless\_wolf/urabe - 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. a\_nameless\_wolf/urabe

ActiveLibrary[Admin Panels](/categories/admin)

a\_nameless\_wolf/urabe
=======================

A CRUD API for database transaction in MySQL, PostgreSQL y ORACLE

16PHP

Since Jan 31Pushed 4y agoCompare

[ Source](https://github.com/ANamelessWolf/urabe)[ Packagist](https://packagist.org/packages/a_nameless_wolf/urabe)[ RSS](/packages/a-nameless-wolf-urabe/feed)WikiDiscussions master Synced 2mo ago

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

URABE-PHP-CRUD-API
==================

[](#urabe-php-crud-api)

`Urabe` is a CRUD and database transaction manager divided in three layers, the first layer is called `KanojoX` acts as a connection manager, wraps the `php-resources` most used functions such as `connect`, `close_connection`,`query`, `fecth_assoc` and `error`. Currently the supported drivers are *ORACLE*, *PG* and *MYSQL*, each driver is associated with a `KanojoX` class, `ORACLEKanojoX`,`PGKanojoX` and `MYSQLKanojoX`. To learn more about the use of `KanojoX` visit the wiki\[[1](https://github.com/ANamelessWolf/urabe/wiki/KanojoX,-The-database-connector)\].

The second layer is called `Urabe`, this layer is created from a `KanojoX` object and wraps most common SQL functions allowing to work transparently between database without changing our code. The function include alias for selecting data, updating, deleting, inserting or other query execution. To learn more about the use of `Urabe` visit the wiki\[[2](https://github.com/ANamelessWolf/urabe/wiki/Urabe-Class,-Introduction)\].

The last layer is called `HasamiWrapper`, this layer manage the CRUD request using `Urabe` as the database manager and the `WebServiceContent` class as the request content. Currently supported verbose `GET`,`POST`,`UPDATE`,`DELETE`. To learn more about the use of `Urabe` visit the wiki\[3\].

How to use it
-------------

[](#how-to-use-it)

Create a new class that extends from `HasamiWrapper`, define the connection data and the table to query. The connection data is specified at the constructor. Lets say we want to make a service that manage the table users.

[![User table](https://raw.githubusercontent.com/ANamelessWolf/urabe/master/testing/img/user_table.PNG)](https://raw.githubusercontent.com/ANamelessWolf/urabe/master/testing/img/user_table.PNG)

```
include_once  "urabe/HasamiWrapper.php";

class  MyService  extends  HasamiWrapper
{
	const  TABLE_NAME  =  "users";

	public  function  __construct()
	{
		$kanojo  =  new  PGKanojoX();
		$kanojo->schema  =  'mySchema';
		$conn = (object)array(
			"host"=> 'localhost',
			"user_name"=> "postgres",
			"password"=>"postgres",
			"port"=>5432,
			"db_name"=>'mydb');
		$kanojo->init($conn);
		$full_table_name = $kanojo->schema  .  "."  .  self::TABLE_NAME
		parent::__construct($full_table_name, $connector, "id");
	}
}
```

In other script lets call it `myServiceEndPoint.php` write the following script. Remember to include path to the class file.

```
include_once  "MyService.php";
$service  =  new  MyService();
$result  =  $service->get_response();
echo json_encode($result, JSON_PRETTY_PRINT);
```

To access the table we're going to send a web request to the service endpoint, lets say is located in the path `http://127.0.0.1/mySite/myServiceEndPoint.php`.

### Select data

[](#select-data)

Now to select data sending a **GET** request, simple request no parameters needed. The response depends of the configuration defined in the [UrabeSettings.php](https://github.com/ANamelessWolf/urabe/blob/master/src/UrabeSettings.php) file.

**Example request:**

```
curl --request GET \ --url 'http://127.0.0.1/mySite/myServiceEndPoint.php'

```

**Example response:**

```
{
    "message": "Selection succeed",
    "result": [
        {
            "id": 2,
            "u_name": "mike",
            "u_pass": "pass123",
        },
        {
            "id": 3,
            "u_name": "user",
            "u_pass": "ua",
        }
    ],
    "size": 2,
    "error": null,
}
```

To select an user that matches and Id, use the reserve name `filter` as **GET** variable to allows the response to be filtered by id.

**Example request:**

```
curl --request GET \ --url 'http://127.0.0.1/mySite/myServiceEndPoint.php?filter=3'

```

**Example response:**

```
{
    "message": "Selection succeed",
    "result": [
        {
            "id": 3,
            "u_name": "user",
            "u_pass": "ua",
        }
    ],
    "size": 1,
    "error": null,
}
```

Now to update, insert and delete, by default the wrapper has this verbose **PUT**, **POST** and **DELETE** blocked, to unblocked them, you can change the `default_*_status` parameters in the [UrabeSettings.php](https://github.com/ANamelessWolf/urabe/blob/master/src/UrabeSettings.php) or adding the following lines in the constructor.

```
$this->set_service_status("PUT", ServiceStatus::AVAILABLE);
$this->set_service_status("DELETE", ServiceStatus::AVAILABLE);
$this->set_service_status("POST", ServiceStatus::AVAILABLE);
```

### Insert data

[](#insert-data)

To insert a new user, the request has to be send as **PUT** and the request body has to be in JSON, and contains the structure:

```
"insert_values": {
    "columns": []
    "values": { }
}
```

Let insert a new user.

**Example request:**

```
curl --request PUT \ --url 'http://127.0.0.1/mySite/myServiceEndPoint.php' \
--header 'Content-Type: application/json' \
--data '{ "insert_values": { "columns": [ "u_name", "u_pass" ], "values": { "u_name": "addedUser", "u_pass": "1234" } } }'

```

**Example response:**

```
{
    "succeed": true,
    "affected_rows": 1,
    "result": [],
    "error": null,
}
```

### Update data

[](#update-data)

To update an user, the request has to be send as **POST** and the request body has to be in JSON, and contains the structure:

```
{
  "values": { },
  "condition": value
}
```

By default the condition is constructed making the primary key value equals to the condition passed value.

**Example request:** This Example updates the user password were the user id is equals to 3.

```
curl --request POST \ --url 'http://127.0.0.1/mySite/myServiceEndPoint.php' \
--header 'Content-Type: application/json' \
--data '{ "values": { "u_pass": "newpass" }, "condition": 3 }

```

**Example response:**

```
{
    "succeed": true,
    "affected_rows": 1,
    "result": [],
    "error": null
}
```

### Delete data

[](#delete-data)

To deletes an user, the request has to be send as **DELETE** and the request body has to be in JSON, and contains the structure:

```
{
  "condition": value
}
```

By default the condition is constructed making the primary key value equals to the condition passed value.

**Example request:** This Example deletes the user were the user id is equals to 5.

```
curl --request DELETE \ --url 'http://127.0.0.1/mySite/myServiceEndPoint.php' \
--header 'Content-Type: application/json' \
--data '{ "condition": 3 }

```

**Example response:**

```
{
    "succeed": true,
    "affected_rows": 1,
    "result": [],
    "error": null
}
```

This concludes the easy guide to the Urabe-API for advance petitions and costume calls visit the Wiki `HasamiWrapper` section.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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.

### Community

Maintainers

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

---

Top Contributors

[![ANamelessWolf](https://avatars.githubusercontent.com/u/21693224?v=4)](https://github.com/ANamelessWolf "ANamelessWolf (148 commits)")

---

Tags

cruddatabase-managementmysqloraclepgsqlphprestful-api

### Embed Badge

![Health badge](/badges/a-nameless-wolf-urabe/health.svg)

```
[![Health](https://phpackages.com/badges/a-nameless-wolf-urabe/health.svg)](https://phpackages.com/packages/a-nameless-wolf-urabe)
```

###  Alternatives

[jeroennoten/laravel-adminlte

Easy AdminLTE integration with Laravel

4.0k4.8M43](/packages/jeroennoten-laravel-adminlte)[dmstr/yii2-adminlte-asset

AdminLTE backend theme asset bundle for Yii 2.0 Framework

1.1k1.8M67](/packages/dmstr-yii2-adminlte-asset)[dwij/laraadmin

LaraAdmin is a Open source Laravel Admin Panel / CMS which can be used as Admin Backend, Data Management Tool or CRM boilerplate for Laravel with features like CRUD Generation, Module Manager, Media, Menus, Backups and much more

1.6k68.7k](/packages/dwij-laraadmin)[filament/spatie-laravel-media-library-plugin

Filament support for `spatie/laravel-medialibrary`.

1764.8M125](/packages/filament-spatie-laravel-media-library-plugin)[bezhansalleh/filament-exceptions

A Simple &amp; Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel

193195.9k13](/packages/bezhansalleh-filament-exceptions)[filament/infolists

Easily add beautiful read-only infolists to any Livewire component.

1220.8M36](/packages/filament-infolists)

PHPackages © 2026

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