PHPackages                             trentino-alto/adige - 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. [Framework](/categories/framework)
4. /
5. trentino-alto/adige

ActiveLibrary[Framework](/categories/framework)

trentino-alto/adige
===================

A small PHP framework with HTTP, console, ORM, migrations, views and validation support.

0.0.6(5d ago)02MITPHPPHP ^8.2

Since Sep 24Pushed 5d ago2 watchersCompare

[ Source](https://github.com/mathmpr/adige)[ Packagist](https://packagist.org/packages/trentino-alto/adige)[ RSS](/packages/trentino-alto-adige/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (17)Used By (0)

Ádige
=====

[](#ádige)

Adige is a small PHP framework with a focused core around:

- HTTP and console request handling
- explicit routing with controller autodiscovery
- a lightweight `ActiveRecord` ORM
- file-based views
- migrations and model validation

About
-----

[](#about)

Adige is the second-largest river in Italy, it was and still is one of the most important rivers in the country since the Middle Ages. The river gives its name to the Trentino-Alto Adige region. The name of the project is just a tribute to the memories of a trip that one of the collaborators (@mathmpr) took to this region of Italy.

Release target
--------------

[](#release-target)

The current release target is `1.0.0-alpha`.

At this stage, Adige can be described as a stabilized microframework for the current line:

- small and focused
- tested around its HTTP core, console flow, ORM, migrations and validation layer
- suitable for small, controlled and serious projects

Important scope note:

- Adige is not positioned as a general replacement for large, battle-tested frameworks
- the current scope is best suited for small applications, internal tools, simple APIs and controlled production environments
- the package baseline is now aligned for the `1.0.0-alpha` distribution model

Public API and compatibility notes for this target are documented in:

- [PUBLIC\_API.md](/home/mathmpr/PhpstormProjects/adige/PUBLIC_API.md)

Git rules
---------

[](#git-rules)

Let's try to use git in a professional way, for this we will establish some rules.

- Try to never commit and push directly to the branch **master** or **develop**.
- Branch models must follow a standard:
    - `adjust` - for general adjustments. EX: `adjust//fix-number-of-params-for-bind-value`
    - `hotfix` - When a bug is in master, we can make a branch directly from master and then make a pull request directly to master, just to fix some "urgent" bug. EX: `hotfix//fix-regex-for-identify-routes`
    - `feature` - when we upload the feature for the first time. EX: `feature/`
    - `enhancement` - when we are going to make a code improvement or refactoring. EX: `enhancement//new-router-system`
- When committing, always type a message about what is inside it in a reduced form.
- When making a pull request, we always point our branch to `develop` (and unless it is a hotfix), and on a certain day of the week or month we move everything from develop to `master`.
- Pull requests must have a description of what was done in the commits contained in it.
- The pull request cannot be **merged** into the target branch until there is at least one **approve** on the pull request and all pull request conversations are resolved.

Goals
-----

[](#goals)

- Study OO concepts.
    - What is an object and what is a class.
    - Understanding the `public`, `private` and `protected` access levels.
    - Differences between static and non-static methods. Understand the properties too.
    - How the concept of inheritance works.
    - How the interface concept works.
    - How the concept for abstract classes works.
- Study the concepts of [DDD](https://engsoftmoderna.info/artigos/ddd.html).
- Create a component for **router** to allow calls to the HTTP: GET methods; POST; OPTIONS; PUT; DELETE.
    - Study the HTTP method.
    - Understand how a **router** works. Study references [laravel](https://laravel.com/docs/9.x/routing), [yii2](https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing) and [slim](https://www.slimframework.com/docs/v4/objects/routing.html).
    - Implement something similar to the basics of **slim** allowing groups of routes.
    - Allow **auto discover** route based on URI.
    - Implement middleware.
- Create base component to perform basic and dynamic operations on the MySQL database.
    - The input must be the **query** and the **array** with the data for any operation.
    - Study how a **query builder** [ORM](https://www.treinaweb.com.br/blog/o-que-e-orm) works
    - Implement a query builder.

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

[](#installation)

Install the package in a consumer project with Composer:

```
composer require trentino-alto/adige
```

The package exposes its console entrypoint through Composer bin proxies:

```
vendor/bin/adige
```

This is the main command entrypoint of the framework.

Package consumption
-------------------

[](#package-consumption)

Adige is now distributed as a Composer library.

The important runtime paths are:

- `package root`: where the framework code itself lives
- `vendor dir`: the consumer project's Composer `vendor/`
- `basePath`: the consumer project root

The console launcher already passes the project root automatically:

```
Adige::run(null, getcwd());
```

If you start the framework manually, pass the consumer base path explicitly:

```
use Adige\core\Adige;

Adige::run(null, __DIR__);
```

Minimal web consumer
--------------------

[](#minimal-web-consumer)

Example project structure:

```
my-app/
├── bootstrap.php
├── public/
│   └── index.php
├── controllers/
│   └── IndexController.php
└── composer.json

```

Example `composer.json` for the consumer project:

```
{
  "require": {
    "trentino-alto/adige": "1.0.0-alpha"
  },
  "autoload": {
    "psr-4": {
      "App\\": ""
    }
  }
}
```

Example `bootstrap.php`:

```
