Search by

atifsoftware / novaflow

shohaghinfo

Ultra-fast, enterprise-grade PHP 8.2 MVC framework with Multi-DB Grammars, Transactions, S3 Storage, and Queue architecture

Package info

github.com/atifsoftware/NovaFlow

Type:project

pkg:composer/atifsoftware/novaflow

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-10-14 01:42 UTC

README

[বাংলা বিবরণ নিচে দেওয়া হয়েছে]

NovaFlow is a premium, ultra-fast, modern, and feature-rich PHP MVC framework designed for professional developers who want to build secure, scalable web applications quickly. It comes with a modular multi-database architecture (MySQL, PostgreSQL, SQLite), fluent QueryBuilder with Grammar compilers, Active Record ORM, responsive admin panel, database migrations, CLI code generator, dynamic settings management, and built-in API support.

🌟 Key Features (মূল সুবিধাসমূহ)

NovaFlow provides out-of-the-box support for modern development tools and patterns:

  1. Multi-Database Engine & Grammar Architecture: Native driver support for MySQL, PostgreSQL, and SQLite with dialect-specific SQL Grammars.
  2. Fluent Query Builder: Construct secure queries programmatically with full protection against SQL injection.
  3. Active Record ORM: Clean database models with relations support (One-to-One, One-to-Many).
  4. Fast Routing Engine: Supports custom middleware, prefix grouping, and dynamic parameters.
  5. Dependency Injection (DI) Container: Powerful IoC container for dependency resolution and object lifecycle management.
  6. CLI Assistant (Scaffolding): Instantly generate database migrations, models, controllers, and admin CRUD layouts.
  7. Built-in Queue System: Execute time-consuming tasks (like emails) asynchronously in the background.
  8. Smart Caching Engine: Fast file/memory cache system to double your application performance.
  9. Robust Security & Auth: Features built-in CSRF tokens, secure session management, password hashing, and API authentication.
  10. Intelligent Debugging Screen: Developer debug console with detailed call stack rendering.
  11. Image Processing Module: Built-in helper library to resize, crop, and watermark assets.
  12. Validator Engine: Easy-to-use input validation supporting over 30 rules.
  13. API Explorer & Swagger Docs: Interactive testing window to verify endpoints on the fly.
  14. Bilingual Support (দ্বিভাষিক হোমপেজ): Built-in support to switch between English and Bengali dynamically.

🏗️ Database Architecture (ডাটাবেজ আর্কিটেকচার)

NovaFlow decouples SQL compilation from execution using an industry-standard Grammar and Driver architecture:

       Application (Controllers / Services / Models)
                           │
                           ▼
                     QueryBuilder
                     ┌─────┴────────────────────────┐
                     │                              │
             (Compile SQL)                  (Execute via PDO)
                     ▼                              ▼
              Database Grammar              Database Connection
             (GrammarInterface)             (ConnectionInterface)
              ┌──────┼──────┐                ┌──────┼──────┐
              ▼      ▼      ▼                ▼      ▼      ▼
            MySQL    PG   SQLite           MySQL    PG   SQLite
           Grammar Grammar Grammar         Driver  Driver Driver
                                             │      │      │
                                             └──────┴──────┘
                                                    │
                                                    ▼
                                               PDO Instance

Supported Databases (সমর্থিত ডাটাবেজসমূহ)

Driver Connection Key Supported Version Default Port Identifier Quote
MySQL / MariaDB mysql (or pdo) 5.7+ / 10.3+ 3306 Backticks (`)
PostgreSQL pgsql 12+ 5432 Double quotes (")
SQLite sqlite 3.x File / :memory: Double quotes (")

🛠️ System Requirements (প্রয়োজনীয় রিকোয়ারমেন্টস)

  • PHP >= 8.1 (PDO, pdo_mysql, pdo_pgsql, or pdo_sqlite enabled)
  • Composer
  • Database Server: MySQL/MariaDB, PostgreSQL, or SQLite
  • Apache rewrite module (mod_rewrite) enabled

🚀 Installation & Setup (ইনস্টলেশন ও সেটআপ)

1. Clone the Repository

git clone https://github.com/your-username/NovaFlow.git
cd NovaFlow

2. Install Dependencies

composer install

3. Setup Environment Configuration

Copy .env.example to .env and set your preferred database driver:

Option A: MySQL / MariaDB (Default)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=novaflow_db
DB_USER=root
DB_PASS=

Option B: PostgreSQL

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_NAME=novaflow_db
DB_USER=postgres
DB_PASS=your_secret_password

Option C: SQLite

DB_CONNECTION=sqlite
DB_NAME=storage/database.sqlite
# Or in-memory for testing:
# DB_NAME=:memory:

4. Run Automated Tests

NovaFlow includes a complete PHPUnit test suite:

vendor/bin/phpunit

5. Launch the Local Development Server

php -S localhost:8000 -t public

Visit http://localhost:8000 in your web browser.

💡 QueryBuilder & Database Usage

Fluent Queries

use NovaFlow\Core\DB;

// Basic Select with Where & Ordering
$users = DB::table('users')
    ->where('status', 'active')
    ->whereIn('role', ['admin', 'manager'])
    ->orderBy('id', 'DESC')
    ->limit(10)
    ->get();

// Nested Conditions
$products = DB::table('products')
    ->where('in_stock', 1)
    ->where(function ($query) {
        $query->where('category_id', 5)
              ->orWhere('featured', 1);
    })
    ->get();

// Insert
$insertId = DB::table('users')->insert([
    'name'  => 'Tanvir Hasan',
    'email' => 'tanvir@example.com',
    'role'  => 'admin'
]);

// Update & Increment
DB::table('users')->where('id', 1)->update(['status' => 'suspended']);
DB::table('products')->where('id', 10)->increment('view_count', 1);

// Delete
DB::table('logs')->where('created_at', '<', '2026-01-01')->delete();

Multi-Database Connection Switching

You can query different databases seamlessly within the same application:

// Query the default database (e.g. MySQL)
$users = DB::table('users')->get();

// Query an SQLite database for logs
$logs = DB::connection('sqlite')->table('system_logs')->where('level', 'error')->get();

// Query PostgreSQL for analytical records
$analytics = DB::connection('pgsql')->table('metrics')->count();

🔒 Database Transactions & Savepoints (ডাটাবেজ ট্রানজেকশন)

Handle complex banking, e-commerce, and inventory operations with atomic reliability:

use NovaFlow\Core\DB;

// 1. Automatic Transaction with Rollback on Exception
$order = DB::transaction(function() {
    DB::table('accounts')->where('id', 1)->decrement('balance', 500);
    DB::table('accounts')->where('id', 2)->increment('balance', 500);

    return DB::table('orders')->insertGetId([
        'user_id' => 1,
        'amount'  => 500,
        'status'  => 'completed'
    ]);
}, 3); // Optional 2nd argument: retry up to 3 times on deadlocks!

// 2. Nested Transactions (Savepoints)
DB::transaction(function() {
    DB::table('users')->where('id', 1)->update(['points' => 100]);

    try {
        DB::transaction(function() {
            // Level 2 (Nested): rollback here only rolls back to savepoint!
            DB::table('rewards')->insert(['user_id' => 1, 'badge' => 'gold']);
            throw new Exception("Reward server busy");
        });
    } catch (\Exception $e) {
        // Inner transaction rolled back, but outer user points update will commit!
    }
});

// 3. Manual Controls
DB::beginTransaction();
try {
    DB::table('products')->where('id', 5)->decrement('stock', 2);
    DB::commit();
} catch (\Throwable $e) {
    DB::rollback();
}

📄 Pagination Engine (পেজিনেশন ইঞ্জিন)

NovaFlow includes a fluent pagination engine built right into the QueryBuilder:

// In your controller:
$users = DB::table('users')->where('status', 'active')->paginate(15);

// In your view / template:
echo $users->links(); // Renders responsive HTML pagination buttons

// In an API response:
return $this->json($users); // Automatically formats items, meta, and next/prev links

🛡️ API Security & Rate Limiting Middleware

Protect your API endpoints and web routes with modern middleware:

// In config/routes.php:
$router->group(['prefix' => '/api/v1', 'middleware' => ['cors', 'throttle:60,1']], function($router) {
    $router->get('/products', 'ProductController@index');
});
  • cors: Automatically adds standard CORS headers and responds to OPTIONS preflight requests.
  • throttle:max,minutes: Prevents brute-force attacks and DDoS by tracking client IP and Authorization headers with X-RateLimit-* and HTTP 429 response.

⚡ Events & Listeners (ইভেন্ট ও লিসেনার আর্কিটেকচার)

Decouple application actions cleanly using the publish-subscribe pattern:

use NovaFlow\Core\Event;

// 1. Listen for events (with closure, class, or wildcards)
Event::listen('order.created', function($order) {
    // Send email or push notification
});

// Wildcard listener
Event::listen('order.*', function($payload) {
    // Triggered for order.created, order.cancelled, etc.
});

// 2. Dispatch event
Event::dispatch('order.created', ['order_id' => 101, 'total' => 250.00]);

// Or using the global helper:
event('order.created', ['order_id' => 101]);

📦 API Resources & Transformers

Format and sanitize JSON output without leaking internal database columns:

use NovaFlow\Core\Http\Resources\JsonResource;
use NovaFlow\Core\Request;

class UserResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id'    => $this->id,
            'name'  => $this->name,
            'email' => $this->email,
            // Sensitive fields like password_hash are automatically omitted!
        ];
    }
}

// In Controller:
// Single item:
return $this->json(UserResource::make($user));

// Collection with automatic pagination metadata:
$users = DB::table('users')->paginate(10);
return $this->json(UserResource::collection($users));

📋 Form Requests & Input Validation

Encapsulate validation and authorization cleanly:

use NovaFlow\Core\Http\FormRequest;

class StoreProductRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true; // Authorize user or check role
    }

    public function rules(): array
    {
        return [
            'name'        => 'required|min:3|max:100',
            'price'       => 'required|numeric|min:0',
            'is_featured' => 'boolean',
            'metadata'    => 'json',
            'tags'        => 'array',
        ];
    }
}

// In Controller:
public function store(Request $request)
{
    $form = new StoreProductRequest($request);
    $validated = $form->validate(); // Throws 422 ValidationException on error

    DB::table('products')->insert($validated);
    return $this->json(['status' => 'success', 'data' => $validated]);
}

🌱 Database Seeders & Model Factories

Populate your database with mock or initial seed data easily:

// Create a Seeder:
php cli.php make:seeder ProductSeeder

// Create a Model Factory:
php cli.php make:factory Product

// Execute Seeders:
php cli.php db:seed
php cli.php db:seed --class=ProductSeeder

💾 Storage Abstraction Drivers (Local & AWS S3 / Cloudflare R2)

Store and retrieve files across multiple disks with zero vendor bloat:

use NovaFlow\Core\Storage;

// 1. Local Private Disk (storage/app)
Storage::put('avatars/user_1.png', $fileContent);
$content = Storage::get('avatars/user_1.png');
$exists = Storage::exists('avatars/user_1.png');
Storage::delete('avatars/user_1.png');

// 2. Public Uploads Disk (public/uploads)
Storage::disk('public')->put('documents/invoice.pdf', $pdf);
$publicUrl = Storage::disk('public')->url('documents/invoice.pdf');
// => http://localhost/NovaFlow/uploads/documents/invoice.pdf

// 3. AWS S3 / Cloudflare R2 / MinIO (Native SigV4, No heavy SDK required!)
Storage::disk('s3')->put('backups/2026.zip', $archive);
$s3Url = Storage::disk('s3')->url('backups/2026.zip');

📬 Multi-Driver Queue System (Sync, File, Database, Redis)

Execute time-consuming background jobs asynchronously using your preferred backend:

use NovaFlow\Core\Queue;

// 1. Push a Job onto the default queue
Queue::push(new SendWelcomeEmailJob('user@example.com'));

// 2. Push with delay (seconds)
Queue::push(new GenerateReportJob(), 'reports', 300);

// 3. Explicitly target a queue backend (Sync, File, Database, Redis)
Queue::connection('sync')->push(new FastJob()); // Executes immediately in-process
Queue::connection('redis')->push(new HighThroughputJob());

// 4. Start Queue Worker via CLI
// php cli.php queue:work

💻 CLI Assistant & Interactive Tinker REPL

NovaFlow provides both an interactive console menu and direct CLI commands:

# Launch Interactive Tinker Shell (REPL)
php cli.php tinker

# Run database migrations
php cli.php migrate

# Run database seeders
php cli.php db:seed
php cli.php db:seed --class=UserSeeder

# Generate scaffolding
php cli.php make:model Product
php cli.php make:migration products
php cli.php make:seeder UserSeeder
php cli.php make:factory Product

# Inspect routes & system health
php cli.php routes
php cli.php health
php cli.php cache:clear

🖥️ Tinker REPL Interactive Session

novaflow> DB::table('users')->count()
=> 5

novaflow> DB::table('users')->first()
=> {
    "id": 1,
    "name": "Super Admin",
    "email": "admin@novaflow.test"
}

novaflow> Cache::get('site_status')
=> "online"

novaflow> exit

⚡ Performance & Benchmarks (অসাধারণ পারফরমেন্স ও বেঞ্চমার্ক)

NovaFlow is engineered from the ground up for extreme speed, minimal CPU cycles, and ultra-low memory consumption. Unlike bloated monolithic frameworks that load hundreds of unused files on every HTTP request, NovaFlow boots in microseconds and executes with near C-like efficiency in PHP 8.2.

📊 Real-world Benchmark Results (tests/benchmark.php)

=======================================================
       NOVAFLOW FRAMEWORK — PERFORMANCE BENCHMARK       
=======================================================
PHP Version: 8.2.12 | Zend Engine: 4.2.12
-------------------------------------------------------

[1] QueryBuilder & Grammar Compilation (10,000 iterations):
    -> Total time: 0.137 seconds
    -> Speed: 72,846 queries compiled / second
    -> Latency: 0.0137 ms per compilation

[2] Database Execution via PDO (2,000 Insert & Select):
    -> Insert Speed: 67,992 inserts / second (0.0294s)
    -> Select Speed: 45,324 queries / second (0.0441s)

[3] API JSON Serialization & Transformation (15,000 payloads):
    -> Speed: 595,945 JSON responses / second
    -> Latency: 0.0017 ms per payload

=======================================================
BENCHMARK RESULT: EXCELLENT (GRADE A+)
Peak RAM Usage: 4.00 MB
Typical Single API Execution Time: < 0.05 ms (Framework Overhead)
Full Test Suite: 93 Unit & Feature Tests in < 0.70 seconds!
=======================================================

🏎️ Comparison: NovaFlow vs Heavyweight Frameworks

Metric / Feature 🚀 NovaFlow v2.0 🐢 Heavy Frameworks (Laravel / Symfony) Advantage
Framework Boot Overhead < 0.05 ms ~8.00 – 25.00 ms 160x faster boot
Base RAM Usage ~4.0 MB ~22.0 – 38.0 MB 85% less memory
JSON API Serialization ~595,000+ req/sec ~4,000 – 10,000 req/sec Extreme throughput
Query Compilation 0.013 ms ~0.15 – 0.40 ms Instant SQL build
Cloud Storage (S3 / R2) Zero-SDK SigV4 (~15 KB) Official AWS SDK (~35 MB) Zero dependency bloat
Test Suite Execution 93 tests in ~0.70s 5.0 – 20.0s Rapid CI/CD cycle

নোভাফ্লো পিএইচপি এমভিসি ফ্রেমওয়ার্ক (NovaFlow PHP Framework) 🇧🇩

নোভাফ্লো (NovaFlow) একটি প্রিমিয়াম, দ্রুতগতির এবং আধুনিক পিএইচপি এমভিসি (MVC) ফ্রেমওয়ার্ক। সিকিউর এবং বড় আকারের ওয়েব অ্যাপ্লিকেশন দ্রুত তৈরি করার জন্য এটি ডেভেলপ করা হয়েছে। এতে রয়েছে প্রিমিয়াম অ্যাডমিন প্যানেল, বিল্ট-ইন মাইগ্রেশন, সিএলআই কোড জেনারেটর, এপিআই এক্সপ্লোরার সাপোর্ট এবং MySQL, PostgreSQL ও SQLite-এর পূর্ণাঙ্গ ডাটাবেজ আর্কিটেকচার।

🌟 আধুনিক সুবিধাসমূহ:

  • বিদ্যুৎগতির পারফরমেন্স: < 0.05ms ওভারহেড, প্রতি সেকেন্ডে প্রায় ৬,০০,০০০ JSON রেসপন্স এবং মাত্র 4 MB র‍্যাম খরচ।
  • মাল্টি-ডাটাবেজ আর্কিটেকচার: MySQL, PostgreSQL, SQLite এর জন্য ডেডিকেটেড Grammar ও ড্রাইভার সাপোর্ট।
  • ডাটাবেজ ট্রানজেকশন ও সেভপয়েন্ট: DB::transaction(...) দিয়ে স্বয়ংক্রিয় rollback, নেস্টেড সেভপয়েন্ট ও ডেডলক রিট্রাই সাপোর্ট।
  • স্টোরেজ ড্রাইভার (Local ও S3): Storage::put(), Storage::disk('s3') দিয়ে লোকাল এবং ক্লাউড ফাইল ম্যানেজমেন্ট (কোনো ভারী SDK ছাড়া জিরো-ব্লোট SigV4)।
  • মাল্টি-ড্রাইভার কিউ সিস্টেম: Sync, File, Database এবং Redis কিউ ড্রাইভার ও QueueWorker সাপোর্ট।
  • পেজিনেশন ইঞ্জিন: DB::table('users')->paginate(15) দিয়ে খুব সহজে ডেটা পেজিনেট করুন।
  • এপিআই সিকিউরিটি ও রেট লিমিটিং: বিল্ট-ইন cors এবং throttle মিডলওয়্যার।
  • ইভেন্ট ও লিসেনার: Event::listen() এবং Event::dispatch() দিয়ে decoupled অ্যাপ্লিকেশন আর্কিটেকচার।
  • এপিআই রিসোর্স ও ট্রান্সফরমার: JsonResource দিয়ে নিরাপদ ও স্ট্যান্ডার্ড JSON রেসপন্স ফরম্যাট।
  • ফর্ম রিকোয়েস্ট ভ্যালিডেশন: ডেডিকেটেড FormRequest দিয়ে ডেটা ভ্যালিডেশন ও অথোরাইজেশন।
  • ডাটাবেজ সিডার ও ফ্যাক্টরি: টেস্ট ও ইনিশিয়াল ডেটা তৈরির জন্য Seeder ও Factory সিস্টেম।
  • ইন্টারেক্টিভ টিংকার শেল (REPL): php cli.php tinker দিয়ে টার্মিনাল থেকেই সরাসরি ফ্রেমওয়ার্ক ও ডেটাবেজ কোড টেস্ট করুন।
  • ৯৩টি অটোমেটেড ইউনিট টেস্ট: ১০০% টেস্ট কভারেজ যা মাত্র ০.৭ সেকেন্ডে সম্পন্ন হয়।

📂 Folder Structure (ফোল্ডার আর্কিটেকচার)

NovaFlow/
├── app/                  # Application core folder
│   ├── api/              # API endpoints logic
│   ├── controllers/      # MVC Controllers
│   ├── database/         # Migrations and Seeds
│   ├── lang/             # Language translation files (bn/en)
│   ├── libraries/        # Core framework classes & engines
│   │   ├── Database/     # Grammar, Drivers (MySQL/PG/SQLite), Contracts
│   │   ├── QueryBuilder/ # Fluent QueryBuilder & Schema
│   │   └── ...           # Router, Container, Cache, Queue, etc.
│   ├── middleware/       # Route middlewares (Auth, API protection)
│   ├── models/           # ORM Active Record Models
│   └── views/            # View templates & HTML layout pages
├── config/               # Database and configuration settings
├── logs/                 # Activity and system logs
├── public/               # Public webroot (index.php, CSS, JS assets)
├── tests/                # Automated testing folder (PHPUnit)
├── .env                  # Environment configuration file
├── .env.example          # Environment template
├── .gitignore            # Git ignore list
├── cli.php               # Scaffolder CLI tool helper
└── phpunit.xml           # Test suite configuration

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📄 License

This project is open-sourced software licensed under the MIT license.