PHPackages                             not-empty/ala-microframework-php - 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. not-empty/ala-microframework-php

ActiveProject[Admin Panels](/categories/admin)

not-empty/ala-microframework-php
================================

API Rest based in lumen using query builder that auto generate base code for simple crud (with automatic generated 100% unit and feature tests). To be used as a simple and fast way to implement microservices architecture

7.0.2(1y ago)251211GPL-3.0-onlyPHPPHP ^8.3

Since Dec 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/not-empty/ala-microframework-php)[ Packagist](https://packagist.org/packages/not-empty/ala-microframework-php)[ RSS](/packages/not-empty-ala-microframework-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (12)Versions (10)Used By (0)

Lumen ALA
=========

[](#lumen-ala)

[![Latest Version](https://camo.githubusercontent.com/2d125f564cbad03323937d84029bf2862d4a94fd1f89bb0a8f4168afffafde52/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e6f742d656d7074792f616c612d6d6963726f6672616d65776f726b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/not-empty/ala-microframework-php/releases)[![codecov](https://camo.githubusercontent.com/9d755d61d2b8f853c1561cb7d8c998ceffa60ae9a9740786accb3a52cbee688c/68747470733a2f2f636f6465636f762e696f2f67682f6e6f742d656d7074792f616c612d6d6963726f6672616d65776f726b2d7068702f67726170682f62616467652e7376673f746f6b656e3d41454d56313633555736)](https://codecov.io/gh/not-empty/ala-microframework-php)[![CI Build](https://camo.githubusercontent.com/2aa2e339ac8666c9ba32213a6a8912c13576525ddf18ecb225de14779c25ee72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6f742d656d7074792f616c612d6d6963726f6672616d65776f726b2d7068702f7068702e796d6c)](https://github.com/not-empty/ala-microframework-php/actions/workflows/php.yml)[![Downloads](https://camo.githubusercontent.com/8c3a6c9d039498f4f6c9f955247fd1642949748d9c93c05a93e1ad5aaf2945e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f742d656d7074792f616c612d6d6963726f6672616d65776f726b2d706870)](https://packagist.org/packages/not-empty/ala-microframework-php)[![PRs Welcome](https://camo.githubusercontent.com/25b3e6d0d42c98de74a98cbb4d149a1c09020cf6d1361993b72d7d5b8ffed363/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://makeapullrequest.com)[![Packagist License (custom server)](https://camo.githubusercontent.com/edb520e092895a00d817741143d1751dfc25af76806a0dd8ec0e93a8ddc3a7a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f742d656d7074792f616c612d6d6963726f6672616d65776f726b2d706870)](https://github.com/not-empty/ala-microframework-php/blob/master/LICENSE)

API Rest based in lumen using query builder that auto generate base code for simple crud (with automatic generated 100% unit and feature tests).

[Release 7.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/7.0.0) Requires [PHP](https://php.net) 8.3

[Release 6.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/6.0.0) Requires [PHP](https://php.net) 8.2

[Release 5.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/5.0.0) Requires [PHP](https://php.net) 8.1

[Release 4.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/4.0.0) Requires [PHP](https://php.net) 7.4

[Release 3.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/3.0.0) Requires [PHP](https://php.net) 7.3

[Release 2.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/2.0.0) Requires [PHP](https://php.net) 7.2

[Release 1.0.0](https://github.com/not-empty/ala-microframework-php/releases/tag/1.0.0) Requires [PHP](https://php.net) 7.1

### Installation

[](#installation)

composer create-project and enter in the created folder (you can fork or clone the repository if you want to)

```
composer create-project not-empty/ala-microframework-php your_project_name
```

(optional) Stop all other containers to avoid conflict.

```
docker stop $(docker ps -q)
```

Start project with Docker using compose tool.

```
docker-compose up -d
```

Access the container

```
docker exec -it ala-php bash
```

Run [Composer](https://getcomposer.org/) to install all dependencies.

```
composer install --prefer-dist
```

Ensure the composer install create the cache folders and give then permissions in ./storage, if don't you'll have to create and give permitions yourself:

```
mkdir storage/framework \
&& mkdir storage/framework/cache \
&& mkdir storage/framework/cache/data \
&& mkdir storage/framework/sessions \
&& mkdir storage/framework/views \
&& chmod -R 777 ./storage
```

To check the build for this project look at ./ops/docker/dev folder.

Copy and modify the .env file

```
cp .env.example .env
```

Include values for `APP_KEY` and `JWT_APP_SECRET`, we strongly recommend a 26 to 32 length random string (can be a ulid)

**You can use `/health/key` uri to generate this keys.**

Now you can access the health-check  and get a json response like this:

```
{
    "status": "online",
    "version": "0.0.1"
}
```

### Creating your automatic crud domain

[](#creating-your-automatic-crud-domain)

For create your brand new domain with a complete crud use the command:

```
php artisan create:domain {your_domain}
```

This command will create a folder in `app/Domains`, new files in `routes`, `database/migrations` and `database/seeds` folder with all base code including all the units and feature tests.

**If your domain name has 2 words use underline (\_) to separate.**

### Configuring your new Domain

[](#configuring-your-new-domain)

- Configure your migration file in `database/migrations` with all your fields and indexes
- Open your domain and configure your fields and the order in `app/Domains/{your_domain}/Http/Parameters`
- Your validator rules can be configured in `app/Domains/{your_domain}/Http/Validators`
- You can modify or add more business rule in `app/Domains/{your_domain}/Businesses`
- Or your routes in `bootstrap/{your_domain}_routes` folder

### Running your Migration

[](#running-your-migration)

- Once you have configured your migration file in `database/migrations`;
- Run the migration

```
php artisan migration
```

### Requests samples

[](#requests-samples)

Within the `/ops/requests` folder, you'll discover a collection of sample requests showcasing.

Requests have been meticulously documented in three different formats for your convenience:

1. Postman Collections

Files: `postman_collection.json` and `postman_environments.json`

Tool: Postman

These collections provide a comprehensive overview of the available API requests. Import them into Postman to explore and execute requests seamlessly.

2. Visual Studio Code (VSCode) REST Client Extension:

File: `requests.http`

Extension: [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)

With the extension installed in VSCode open the `requests.http` file. This extension allows you to send HTTP requests directly from your code editor, making it easy to interact with the API.

3. CURL Commands:

File: `requests.curl`

For those who prefer the command line, CURL commands are provided in the `requests.curl` file. Execute these commands in your terminal to interact with the API using the widely-used CURL tool.

Choose the documentation format that aligns with your preferred workflow and start seamlessly interacting with the API.

### Ulid

[](#ulid)

For primary key value, this project using [Ulid](https://github.com/not-empty/ulid-php-lib) value, but you can pass other pattern in insert route if you prefer.

### JWT

[](#jwt)

In auth route this projet use [JWT](https://github.com/not-empty/jwt-manager-php-lib) lib. This token will be generate if your secret, token and context is correct. This configuration is the `token.php` file in `app/config/` folder.

We strongly advise you to change these values, they can be either random strings, ulids or any string that you like.

We use to generate then by encrypting an ulid v4 with SHA512/256.

We recommend creating diferents tokens from diferents sources.

```
return [
    'data' => [
        '32c5a206ee876f4c6e1c483457561dbed02a531a89b380c3298bb131a844ac3c' => [ // default token
            'name' => 'app-test', // default context
            'secret' => 'a1c5930d778e632c6684945ca15bcf3c752d17502d4cfbd1184024be6de14540', // default secret
        ],
    ],
];
```

### Request Service

[](#request-service)

To make request between two or more services, this project use [Request Service](https://github.com/not-empty/request-service-php-lib) lib.

### Response

[](#response)

The pattern used to return all request is json and the layout is configure in your [Response](https://github.com/not-empty/ala-microframework-php) lib.

### Custom Validators

[](#custom-validators)

I you want to implement custom validators you can use the regex function and add you regex to the patterns file `/app/Constants/PatternsConstants.php` and then just use anywhere but dont forget to declare the class for use:

```
use App\Constants\PatternsConstants;
```

### Filters

[](#filters)

Follow this steps to configure a new field to accepted a filter in list route

- In your domain validators list file `app/Domains/{your_domain}/Http/Validators/{your_domain}ListValidator` you can change or add more filters options.

For example, to add a filter to `age` field just include a new entry like that

```
/**
 * get rules for this request
 * @return array
 */
public function getRules() : array
{
    return [
        'class' => 'string|in:"asc","desc"',
        'fields' => 'string',
        'order' => 'string',
        'page' => 'integer|min:1',
        'filter_name' => [
            'string',
            'regex:'.PatternsConstants::FILTER,
        ],
        // here your new filter
        'filter_age' => [
            'string',
            'regex:'.PatternsConstants::FILTER,
        ],
    ];
}
```

After that, you need to configure your filters in `app/Domains/{your_domain}/Filters`.

you can user various patterns like `FILTER_EQUAL`, `FILTER_NOT_EQUAL`, etc.

**Check all types look at `FiltersTypesConstants` class in `app/Constants`.**

```
/**
 * set filter rules for this domain
 */
public $filter = [
    'age' => [
        'validate' => 'integer|min:18|max:99',
        'permissions' => [
            FiltersTypesConstants::FILTER_EQUAL,
            FiltersTypesConstants::FILTER_NOT_EQUAL,
        ],
    ],
    'created' => [
        'validate' => 'date',
        'permissions' => [
            FiltersTypesConstants::FILTER_LESS_THAN,
            FiltersTypesConstants::FILTER_GREATER_THAN,
            FiltersTypesConstants::FILTER_GREATER_THAN_OR_EQUAL,
            FiltersTypesConstants::FILTER_LESS_THAN_OR_EQUAL,
        ],
    ],
    'modified' => [
        'validate' => 'date',
        'permissions' => [
            FiltersTypesConstants::FILTER_LESS_THAN,
            FiltersTypesConstants::FILTER_GREATER_THAN,
            FiltersTypesConstants::FILTER_GREATER_THAN_OR_EQUAL,
            FiltersTypesConstants::FILTER_LESS_THAN_OR_EQUAL,
        ],
    ],
];
```

After that you can send this param in url query, for example:

`/{your_domain}/list?filter_name=lik,vitor` OR `/{your_domain}/list?filter_name=eql,vitor`.

### Recomendations

[](#recomendations)

Use this project with [MySql](https://www.mysql.com/) with no relationship keys and NOT use JOIN.

### Production

[](#production)

Don't forget to change `APP_ENV` to `production` value. This enable the op\_cache PHP extension, so dont use in development environment.

The production docker is located in `ops/docker/prod` and you can change the Nginx config or PHP all the way you want.

### Development

[](#development)

Want to contribute? Great!

Make a change and be careful with your updates! **Any new code will only be accepted with all validations.**

To ensure that the entire project is fine:

First install the dependences (with development ones)

```
composer install --dev --prefer-dist
```

Second run all validations

```
composer checkall
```

You can run all validations plus test coverage metrics

```
composer checkallcover
```

### Code Quality

[](#code-quality)

We create this project under stricts good pratices rules. Bellow you can see some composer commands to validate the framework code and your code as well.

**We recommend you aways run the `composer checkallcover` command to validate all your code, tests and coverage.**

lint - check for sintax errors on PHP (PHP Lint)

```
composer lint
```

cs - check for smells in general (Code Snifer)

```
composer cs
```

mess - check for smells in a more deep way (Mess Detector)

```
composer mess
```

test - run all tests (Unit and Feature)

```
composer test
```

test-cover - run all tests with code coverage (Unit and Feature)

```
composer test-cover
```

test-unit - run all unit tests

```
composer test-unit
```

test-unit-cover - run all unit tests with code coverage

```
composer test-unit-cover
```

test-feat - run all feature tests

```
composer test-feat
```

test-feat-cover - run all feature tests with code coverage

```
composer test-feat-cover
```

ccu - check unit coverage level (100% is required)

```
composer ccu
```

ccf - check feature coverage level (100% is required)

```
composer ccf
```

check - execute lint, cs, mess and unit tests

```
composer check
```

checkcover - execute lint, cs, mess and unit tests with coverage

```
composer check
```

checkall - execute lint, cs, mess, unit and feature tests

```
composer check
```

checkall - execute lint, cs, mess, unit and feature tests with coverage

```
composer check
```

\#Sonarqube

This project is also validated with Sonarqube, has a `sonar-project.properties` file to support sonarqube execution.

To do that, edit the `sonar-project.properties` with your sonar url (maybe something like  if you running sonar in your machine), and then execute sonar scan.

[![Sonarqube results](https://github.com/not-empty/ala-microframework-php/raw/master/ops/sonar.png)](https://github.com/not-empty/ala-microframework-php/blob/master/ops/sonar.png)

### Automatic Validation Before Commit

[](#automatic-validation-before-commit)

If you want to force the `checkallcover` in your project before commit, you can just copy the file `ops/contrib/pre-commit` to your `.git/hook`. Be aware your development environment will need to have PHP with xdebug installed in order to commit.

```
    cp ops/contrib/pre-commit .git/hooks/pre-commit
    chmod +x .git/hooks/pre-commit
```

### Random Seed Data

[](#random-seed-data)

You can create an automatic seeder to generate data using you add endpoint to tests purposes (or any other purpose you like).

To do that you must create a random seeder with the command:

```
php artisan random:create {domain_name}
```

It will create a file inside `app/Seeds/` with your domain name with all possibilities.

You may change to fullfill your needs (and your domain validations)

Now you may configure on `.env` the `SEED_URL`and `SEED_PORT` environments. (if you want to run inside docker don't change at all).

And run your seed with the domain name and the amount to records to generate.

```
php artisan random:seed {domain_name} {number_of_records}
```

Then use the list endpoint, or make a select in database to see the results.

**Not Empty Foundation - Free codes, full minds**

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 92.1% 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 ~46 days

Recently: every ~92 days

Total

9

Last Release

527d ago

Major Versions

1.0.0 → 2.0.02023-12-04

2.0.0 → 7.0.12024-12-07

PHP version history (7 changes)7.0.0PHP ^8.3

6.0.0PHP ^8.2

5.0.0PHP ^8.1

4.0.0PHP ^7.4

3.0.0PHP ^7.3

1.0.0PHP ^7.1

2.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/febe33cd8961e65ed6afafa8b426ad68f95521285e9145313764001d67028914?d=identicon)[not-empty](/maintainers/not-empty)

---

Top Contributors

[![leodisarli](https://avatars.githubusercontent.com/u/1638455?v=4)](https://github.com/leodisarli "leodisarli (35 commits)")[![espositovitor](https://avatars.githubusercontent.com/u/26362498?v=4)](https://github.com/espositovitor "espositovitor (2 commits)")[![jpmgoncalves12](https://avatars.githubusercontent.com/u/97133237?v=4)](https://github.com/jpmgoncalves12 "jpmgoncalves12 (1 commits)")

---

Tags

phplaravellumencrudmicroframeworkcode-generationmicroservices

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/not-empty-ala-microframework-php/health.svg)

```
[![Health](https://phpackages.com/badges/not-empty-ala-microframework-php/health.svg)](https://phpackages.com/packages/not-empty-ala-microframework-php)
```

###  Alternatives

[inani/nova-resource-maker

A Laravel Nova package to help you generate resources fields

2513.7k](/packages/inani-nova-resource-maker)

PHPackages © 2026

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