PHPackages                             fabiomattei/uglyduckling - 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. fabiomattei/uglyduckling

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

fabiomattei/uglyduckling
========================

Framework to create web applications using json structures

0.3.0(1y ago)32.0k1GPL-3.0-or-laterPHPPHP &gt;=7.4

Since Jul 20Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/fabiomattei/uglyduckling)[ Packagist](https://packagist.org/packages/fabiomattei/uglyduckling)[ RSS](/packages/fabiomattei-uglyduckling/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (6)Used By (1)

Notes
=====

[](#notes)

### Documentation

[](#documentation)

If you are looking for a more complete description of the project check out the documentation site: [](https://www.uddocs.com/)

### Demo

[](#demo)

This [demo](https://github.com/fabiomattei/ud-demo) shows the main features of the library.

### The best code is the code you don't need to write

[](#the-best-code-is-the-code-you-dont-need-to-write)

I wrote this code in order to avoid to write over and over again the same stuff. I have been writing web applications for many years. What were those applications doing? They were thaking data from a form, saving that data in a database and then editing that data in another form and showing that data in a table or in a diagram ad sometimes they were deleting that data (not very often to be fair).

Well, I have done that over and over again, form after form, ORM after ORM, MVC after MVC.

I felt lost and bored. I was working so hard and I was accomplishing so little.

I have learned many framework to speed up my process, I read many books: the new thing, so exiting!

Then I started to notice that my work was repeatable and those frameworks were slowing me down.

With an MVC approach each change you wond to make to your application requires you open at least 3 files.

So I started to wonder: What do I really need in order to make for example a table cotaining data taken from a database? The answer was: I need to make a SQL query, I need to define the structure of the table and I need to put the results of the query on the table. That's it. I need this three things, nothig more than that.

I put all this information in a json file and this came out:

```
{
  "query": {
    "sql": "select id, name, amount, duedate FROM requestv1;"
  },
  "table": {
    "title": "My table",
    "fields": [
      {"headline": "Name", "sqlfield": "name"},
      {"headline": "Amount", "sqlfield": "amount"},
      {"headline": "Due date", "sqlfield": "duedate"}
    ]
  }
}
```

No ORM, no MVC, and a framework that stays out of my way.

I know I used SQL and not an ORM but I like SQL! SQL haven't changed in ages, and this means that it works! It is not sad to be old!

I gave a title to the table and in the fields array I defined the headlines and the sql fields that were taken from the query in order to fill the cells of that table. How many times have you solved this same simple problem? Have you ever done it writing less code? If that is true please let me know!

I know what you are thinking about: this is not general enough, what if I need to make calculations or generalize some logic or do something more complicated? Well, you can always get back to your old way, and program a controller a view, maybe made of partials, connect and ORM, write down your model and... so on and so on and so on...

But, let's be straight, do you really need it? How often do you do that? I often found mysel filling a table with the results of just one query, maybe with few joined tables.

### Let's add some link

[](#lets-add-some-link)

What if I need to add a link to some supported action to the table? I defined that in the json format too.

```
{
  "query": {
    "sql": "select id, name, amount, duedate FROM requestv1;"
  },
  "table": {
    "title": "My table",
    "fields": [
      {"headline": "Name", "sqlfield": "name"},
      {"headline": "Amount", "sqlfield": "amount"},
      {"headline": "Due date", "sqlfield": "duedate"}
    ],
    "actions": [
      {"label": "Info", "resource": "inforequest", "parameters":[{"name": "id", "sqlfield": "id"}] },
      {"label": "Edit", "resource": "formrequest", "parameters":[{"name": "id", "sqlfield": "id"}] },
      {"label": "Delete", "resource": "deletereport", "parameters":[{"name": "id", "sqlfield": "id"}] }
    ]
  }
}
```

A link is defined from a label (the user need to see what is clicking) an action and few parameters maybe coming from the SQL query.

If you are wondering what a resource is, it is a index to find a specific json configuration file, like this one, in the system. There are resources for forms, for pdf exports, for data charts, for whatever you need. And if you need more you can always define a new template, this is an open source project after all.

### Let's finish up the json file

[](#lets-finish-up-the-json-file)

There are few things to do in order to complete the file. We neet to give it a name so we can find it between al the resources. We need to add some metadata, in case in the future we need to add more features.

The system supports the concept of allowed groups to access a specific resource, this explains the "allowedgroups" array.

There is a get section in this file, it is there because all this configurations are for a GET request.

```
{
  "name": "requesttablev1",
  "metadata": { "type":"table", "version": "1" },
  "allowedgroups": [ "administrationgroup", "teachergroup", "managergroup" ],
  "get": {
    "request": {
      "parameters": []
    },
    "query": {
      "sql": "select id, name, amount, duedate FROM requestv1;"
    },
    "table": {
      "title": "My table",
      "fields": [
        {"headline": "Name", "sqlfield": "name"},
        {"headline": "Amount", "sqlfield": "amount"},
        {"headline": "Due date", "sqlfield": "duedate"}
      ],
      "actions": [
        {"label": "Info", "resource": "inforequest", "parameters":[{"name": "id", "sqlfield": "id"}] },
        {"label": "Edit", "resource": "formrequest", "parameters":[{"name": "id", "sqlfield": "id"}] },
        {"label": "Delete", "resource": "deletereport", "parameters":[{"name": "id", "sqlfield": "id"}] }
      ]
    }
  }
}
```

If you can use the standard templates you can make an entire application just filling the src/Custom folder with all the resources you need. Open that folder and have a look so you can see how the other resources are defined.

### Static check using phpstan

[](#static-check-using-phpstan)

```
vendor/bin/phpstan --memory-limit=1G analyse src
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance66

Regular maintenance activity

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

674d ago

PHP version history (3 changes)v0.1.0PHP &gt;=7.0

v0.2.0PHP &gt;=7.3

0.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/30a5a3114e0da7b8d7e04188fa64849550f2de9aab912e02837c38e1f4020ed7?d=identicon)[fabiomattei](/maintainers/fabiomattei)

---

Top Contributors

[![fabiomattei](https://avatars.githubusercontent.com/u/87440?v=4)](https://github.com/fabiomattei "fabiomattei (1753 commits)")

---

Tags

jsonphpphp-frameworksqltemplatedesignsoftware

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fabiomattei-uglyduckling/health.svg)

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

###  Alternatives

[johnitvn/yii2-ajaxcrud

Gii CRUD template for Single Page Ajax Administration for yii2

97209.6k16](/packages/johnitvn-yii2-ajaxcrud)

PHPackages © 2026

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