PHPackages                             jarivas/no-orm - 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. jarivas/no-orm

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

jarivas/no-orm
==============

A simple and light SQL lib

2.0.2(5y ago)013MITPHP

Since Jun 18Pushed 5y agoCompare

[ Source](https://github.com/jarivas/no-orm)[ Packagist](https://packagist.org/packages/jarivas/no-orm)[ RSS](/packages/jarivas-no-orm/feed)WikiDiscussions master Synced today

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

no-orm
======

[](#no-orm)

A simple and light SQL lib that you were needing it and not knowing

- Generates Entities
- Requires very basic Mysql knowledge
- No obscure code
- Pascal cased getter and setters
- Column names as constants
- Handles relationships automatically

Getting Started
---------------

[](#getting-started)

- `composer require jarivas/no-orm`
- $host is the mysql host
- $dbname schema name where read tables to generate helper classes
- $username mysql user
- $password mysql password
- $targetFolder where in the file system you want the files to be located
- $namespace, is a string with a standard php namespace, for example 'Db\\Book'

### Generating classes

[](#generating-classes)

- `use NoOrm\EntityGenerator;`
- `$result = EntityGenerator::process($host, $dbname, $username, $password, $targetFolder, $namespace)`
- My recommendation is create php command in order to generate files everytime you want

### Examples

[](#examples)

- I have been using this db example [https://github.com/datacharmer/test\_db](https://github.com/datacharmer/test_db)
- Select the first 1000 rows `$result = Entity\CurrentDeptEmp::get();`
- Get the value of the column emp\_no of the first row `$result[0]->getEmpNo()`
- Insert

```
$columns = [
    Entity\Departments::COL_DEPT_NO,
    Entity\Departments::COL_DEPT_NAME
];

$values = [
    'd010',
    'Test'
];

$result = Entity\Departments::insertOne($columns, $values);

```

- Update

```
$assignments = [
    Entity\Departments::COL_DEPT_NAME . ' = "HOLA"'
];

$where = [
    [
        'operator' => 'AND',
        'condition' => Entity\Departments::COL_DEPT_NO . ' = "d010"'
    ]
];

$result = Entity\Departments::update($assignments, $where);

```

- Delete `$result = Entity\Departments::delete($where);`

API
---

[](#api)

- All the generated classes contains `const`s that begins with `COL` that represent that column in the db, example `CurrentDeptEmp::COL_DEPT_NO`
- The where and having syntax are the same across the methods
- Projection means the selected fields from the query
- If you do not specify any projection by default will generate all fields PascalCased instead of snake\_cased `emp_no` =&gt; `EmpNo`, also will include the ones on the relations
- The relations fields will have the upper case table name prefixed `DEPARTMENTS_DeptNo` or `EMPLOYEES_BirthDate`
- The trait EntityBody will be on each generated class and will be the one who generates and executes the queries
- Those methods are `get`, `insertOne`, `update`, `delete`

```
/**
 * Retrieves an array of Entities (same class where was invoked)
 * @param array $projection (array of class's columns constant)
 * @param array $where (array of ['operator' => AND|OR, 'condition' => COL_CONSTANT . ' =, like ....'])
 * @param string $group (an string that you would place after GROUP BY)
 * @param array $having (same as $where)
 * @param string $order (an string that you would place after ORDER BY)
 * @param int $limit (in case you need it)
 * @param int $offset (in case you need it)
 * @return array[Entity]
 */
public static function get(array $projection = [], array $where = [],
    string $group = '', array $having = [], string $order = '',
    int $limit = 1000, int $offset = 0): array

/**
 * Inserts a new row in the table
 * @param array $columns (array of class's columns constant)
 * @param array $values (array of values in the same order as $columns)
 * @param string $onDuplicateKeyUpdate (an string that you would place after ON DUPLICATED KEY UPDATE)
 * @return int (number of rows affected)
 */
public static function insertOne(array $columns, array $values,
        string $onDuplicateKeyUpdate = ''): int

/**
 * Updates one or more rows in the table
 * @param array $assignments
 * @param array $where (array of ['operator' => AND|OR, 'condition' => COL_CONSTANT . ' =, like ....'])
 * @param string $order (an string that you would place after ORDER BY)
 * @param int $limit (in case you need it)
 * @return bool (true in case of success)
 */
public static function update(array $assignments, array $where = [],
    string $order = '', int $limit = 0): bool

/**
 * Deletes one or more rows in the table
 * @param array $where (array of ['operator' => AND|OR, 'condition' => COL_CONSTANT . ' =, like ....'])
 * @param string $order (an string that you would place after ORDER BY)
 * @param int $limit (in case you need it)
 * @return bool (true in case of success)
 */
public static function delete(array $where = [], string $order = '', int $limit = 0): bool

```

###  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

Maturity54

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

Total

3

Last Release

1838d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/993232a6d5ef5977556ddfaa67ea9510c39d36e3cb08ce2fc88bea4e29dcc3c8?d=identicon)[jarivas](/maintainers/jarivas)

---

Top Contributors

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

---

Tags

mysqlormphp

### Embed Badge

![Health badge](/badges/jarivas-no-orm/health.svg)

```
[![Health](https://phpackages.com/badges/jarivas-no-orm/health.svg)](https://phpackages.com/packages/jarivas-no-orm)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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