Search by

arefshojaei / delta-app

ArefShojaei

Delta Application

Package info

github.com/ArefShojaei/Delta-app

Type:project

pkg:composer/arefshojaei/delta-app

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-28 12:41 UTC

This package is auto-updated.

Last update: 2026-08-28 12:41:46 UTC


README

Delta Application — A starter REST API project built on the Delta PHP framework.

It provides a ready-to-use modular structure for building clean JSON APIs with attribute-based routing, dependency injection, Eloquent models, and Swagger documentation.

Packagist: arefshojaei/delta-app

Features

  • Modular architecture (App, User, Swagger modules)
  • Attribute-based controllers & routes (GET, POST, PUT, PATCH, DELETE)
  • Full User CRUD API (/api/users)
  • OpenAPI / Swagger UI at /docs
  • Eloquent ORM (Illuminate Database)
  • File-based cache & logging
  • CLI helper (bin/cli) for serving the app and generating Swagger docs
  • PHP 8.2+

Requirements

  • PHP >= 8.2
  • Composer
  • Database (MySQL / MariaDB recommended)

Installation

Option 1 — Create project with Composer (recommended)

composer create-project arefshojaei/delta-app my-delta-app
cd my-delta-app

Currently the package is published as dev-main.
If needed you can force it with:

composer create-project arefshojaei/delta-app my-delta-app dev-main

Option 2 — Clone from GitHub

git clone https://github.com/ArefShojaei/Delta-app.git
cd Delta-app
composer install

Configure environment

cp .env.example .env

Edit .env and set your database credentials:

APP_NAME=Delta
APP_ENV=local

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=delta
DB_USERNAME=root
DB_PASSWORD=

Create the database and run any migrations/seeders located under database/.

Running the Application

Using the built-in CLI

# Default: localhost:5000
php bin/cli serve

# Custom host / port
php bin/cli serve --host=127.0.0.1 --port=8000

Or with PHP’s built-in server

php -S 127.0.0.1:8000 -t public

Open the browser at http://127.0.0.1:8000 (or the host/port you chose).

Project Structure

Delta-app/
├── bin/
│   └── cli                     # Console entry point
├── console/
│   └── commands.php            # CLI commands
├── database/
│   ├── factories/
│   ├── migrations/
│   └── seeders/
├── public/
│   ├── index.php               # Application entry point
│   └── swagger.json            # Generated OpenAPI specification
├── src/
│   ├── Database/
│   │   └── DatabaseManager.php
│   └── Modules/
│       ├── App/                # Root module
│       ├── User/               # User CRUD module
│       └── Swagger/            # Swagger UI module
├── storage/
│   ├── cache/
│   └── logs/
├── .env.example
└── composer.json

How It Works

  1. public/index.php bootstraps the Delta application using the root AppModule.
  2. AppModule imports UserModule and SwaggerModule.
  3. Controllers are registered via PHP attributes (#[Controller], #[Get], #[Post], …).
  4. Services marked with #[Injectable] are automatically injected into controllers.
  5. DatabaseManager boots Illuminate Capsule / Eloquent on every request.
  6. Responses are sent as JSON through Delta’s Response object.

Available Endpoints

Method Path Description
GET / Welcome / health check
GET /api/users List all users
GET /api/users/{id} Get a single user
POST /api/users Create a user
PUT /api/users/{id} Full update
PATCH /api/users/{id} Partial update
DELETE /api/users/{id} Delete a user
GET /docs Swagger UI
GET /docs/swagger.json OpenAPI JSON

Generating Swagger Documentation

php bin/cli swagger:generate

License

MIT