Skip to content

ubdencom/coff-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚠️ Disclaimer

This software is an open-source project developed for the community and is not affiliated with any organization or institution.
It is shared purely for educational purposes, software development testing, and to contribute to the growth of the open-source community.


βš–οΈ Legal Responsibility

By using this software, you agree that:

  • All responsibility lies with you, the user.
  • The platform and its contributors provide this software "as is", without any warranty of any kind, express or implied.
    This includes, but is not limited to, the warranties of merchantability, fitness for a particular purpose, or non-infringement.

⚠️ Use it at your own risk.


🎯 Intended Use

The primary purpose of this project is to:

  • Educate the community by sharing open-source code.
  • Facilitate learning and encourage innovation through open collaboration.

❌ This software is not intended for production use.
We strongly recommend purchasing and using professionally licensed software for your needs.


πŸ™Œ Support the Community

If you would like to support the community and this project, consider making a donation:
Donate


🚨 Report Abuse

If you encounter any abuse or misuse of this software, please report it to:
πŸ“§ [email protected]


Thank you for being a part of the open-source community! 🌟

Coff PHP Framework (v2.0)

Coff PHP Framework is a modern, lightweight, and AI-friendly PHP framework designed for speed, efficiency, and predictability.

With version 2.0, the framework has been re-architected to support microservices, strict typing, and modern dependency injection patterns while maintaining its simplicity.

πŸš€ Features

  • AI-Friendly Architecture: Strict typing, predictable interfaces, and PSR standards make it easy for AI assistants to understand and generate code.
  • Modern Core: A completely refactored kernel (src/Core) with a powerful Dependency Injection Container.
  • Microservice Ready: Built-in support for JSON APIs, Stateless Authentication (JWT-ready), and standardized API Responses.
  • Dual Routing System: Supports both modern Route definitions (routes/web.php, routes/api.php) and legacy folder-based routing (?path=Handler).
  • Robust Logging: Integrated Monolog support for professional-grade logging.
  • Lightweight: Minimal overhead compared to Laravel or Symfony.

πŸ“‚ Project Structure

The framework follows a clean separation of concerns:

coff-framework/
β”œβ”€β”€ app/                # Application Logic (Your Code)
β”‚   β”œβ”€β”€ Controllers/    # Web Controllers
β”‚   β”œβ”€β”€ Models/         # Database Models
β”‚   └── Services/       # Business Logic
β”œβ”€β”€ config/             # Configuration Files
β”œβ”€β”€ public/             # Web Entry Point (index.php)
β”œβ”€β”€ routes/             # Route Definitions
β”‚   β”œβ”€β”€ api.php         # API Routes (Microservices)
β”‚   └── web.php         # Web Routes
β”œβ”€β”€ src/                # Framework Core (Do Not Edit)
β”‚   β”œβ”€β”€ Auth/           # Authentication Guards
β”‚   β”œβ”€β”€ Core/           # Container, Application, Logger
β”‚   └── Http/           # Kernel, Router, Request, Response
└── vendor/             # Composer Dependencies

πŸ› οΈ Getting Started

Prerequisites

  • PHP 7.4 or higher
  • Composer

Installation

  1. Clone the repository:
    git clone https://github.com/ubden/coff-framework.git
  2. Install dependencies:
    composer install
  3. Set up your environment: Copy .env.example to .env (if available) and configure your database.

πŸ“– Usage

Routing

Define your routes in routes/web.php or routes/api.php.

// routes/api.php
$router->get('/users', 'App\Controllers\UserController@index');

// routes/web.php
$router->get('/', function() {
    echo "Welcome to Coff Framework!";
});

Dependency Injection

The new Container supports auto-wiring. You can type-hint dependencies in your controller constructors.

use Coff\Framework\Core\Logger;

class UserController {
    protected $logger;

    public function __construct(Logger $logger) {
        $this->logger = $logger;
    }

    public function index() {
        $this->logger->info('User list accessed');
        // ...
    }
}

API Responses

Use the ApiResponse helper for consistent JSON output.

use Coff\Framework\Http\ApiResponse;

public function index() {
    return ApiResponse::success(['id' => 1, 'name' => 'John Doe']);
}

Legacy Support

The framework maintains backward compatibility with the old ?path=Page routing style, ensuring your existing modules continue to work while you migrate to the new structure.

🀝 Comparison

Coff vs Laravel

  • Performance: Coff is significantly lighter and faster for small-to-medium projects and microservices.
  • Simplicity: No complex facades or magic methods; just pure, understandable PHP.

Coff vs Symfony

  • Flexibility: Coff provides a minimal structure, giving you total freedom over your architecture.
  • Learning Curve: You can understand the entire core code in an afternoon.

πŸ“ž Contact Us

Have questions or need support? Feel free to reach out!

For more details, visit our website or open an issue on our GitHub page.