arefshojaei / delta-app
Delta Application
dev-main
2026-08-28 12:41 UTC
Requires
- php: >=8.2
- arefshojaei/delta: ^1.0
- arefshojaei/php-x: ^1.6
- doctrine/annotations: ^2.0
- fakerphp/faker: ^1.24
- illuminate/database: ^13.29
- symfony/var-dumper: ^7.4
- zircote/swagger-php: ^5.7
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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
public/index.phpbootstraps the Delta application using the rootAppModule.AppModuleimportsUserModuleandSwaggerModule.- Controllers are registered via PHP attributes (
#[Controller],#[Get],#[Post], …). - Services marked with
#[Injectable]are automatically injected into controllers. DatabaseManagerboots Illuminate Capsule / Eloquent on every request.- Responses are sent as JSON through Delta’s
Responseobject.
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