PHPackages                             moehakram/webphp-oop - 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. [Framework](/categories/framework)
4. /
5. moehakram/webphp-oop

ActiveProject[Framework](/categories/framework)

moehakram/webphp-oop
====================

An elegant PHP framework leveraging OOP principles to simplify.

01PHP

Since Aug 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/moehakram/webphp-oop)[ Packagist](https://packagist.org/packages/moehakram/webphp-oop)[ RSS](/packages/moehakram-webphp-oop/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Table of Contents
-----------------

[](#table-of-contents)

- [Table of Contents](#table-of-contents)
- [About The Project](#about-the-project)
- [Getting Started](#getting-started)
- [Usage](#usage)
    - [Configuration](#configuration)
    - [Routing Patterns](#routing-patterns)
    - [Callback Formats](#callback-formats)
        - [Summary](#summary)
    - [Implementing Middleware](#implementing-middleware)

About The Project
-----------------

[](#about-the-project)

This framework is a simple solution for native PHP projects that integrates object-oriented programming (OOP) principles. It is designed to facilitate PHP application development by providing tools for streamlined routing management.

Getting Started
---------------

[](#getting-started)

To start using this framework, follow these steps:

1. Clone this repository to your local directory.
2. Run `composer install` to install the necessary dependencies.

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Database configuration is located in `/config/config.php`.

To start a local server, use the following command:

```
composer serve
```

### Routing Patterns

[](#routing-patterns)

Routing configuration is located in `/config/routes.php`.

```
// Example: `http://localhost:8080/users/123`
$router->get('/users/:id', function($id, Request $req) {
    return "User ID: " . $id;  // Output: User ID: 123
});

// Example: `http://localhost:8080/users/asd123`
$router->get('/users/:id', function($id, Request $req) {
    return "User ID: " . $id;  // Output: User ID: asd123
});

// Example: `http://localhost:8080/search/name_group/123`
$router->get('/search/:group/:id', function($group, $id, Request $req) {
    return "Group / ID: " . $group . '/' . $id;  // Output: Group / ID: name_group/123
});
```

### Callback Formats

[](#callback-formats)

The framework accepts various callback formats:

1. **Array Callback:**

    The callback should be an array with two elements: the controller class name and the method name.

    ```
    $router->get('/array', [HomeController::class, 'index']);
    ```
2. **String Callback:**

    The callback should be a string in the format `'Controller@method'`, where `Controller` is the controller class name and `method` is the method name.

    ```
    $router->get('/string', 'HomeController@index');
    ```
3. **Callable Callback:**

    The callback should be a callable, such as a closure, anonymous function, or any function defined as callable.

    ```
    $router->get('/anonymous-function', function() {
        return "Hello World";
    });

    $router->get('/arrow-function', fn() => "Hello World");
    ```

#### Summary

[](#summary)

- **Array:** `[ControllerClass::class, 'methodName']`
- **String:** `'Controller@method'`
- **Callable:** `function(Request $req) { ... }` or `fn(Request $req) => ...`

### Implementing Middleware

[](#implementing-middleware)

You can add middleware to your routes by passing them as additional parameters to the `get` method.

```
// Middleware example
class AuthMiddleware implements Middleware {
    public function execute(Request $request, callable $next)
    {
        // Authentication logic
        if (!$request->user) {
            return redirect('/login');
        }

        return $next($request);
    }
}

// Applying middleware to a route
//$router->get(string $path, $callback, ...$middlewares): void
$router->get('/dashboard', 'DashboardController@index', AuthMiddleware::class);
```

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e9a95715f4ff1093ca07eae58b8e59af70d8236561d06c7694562129ab8c6d8?d=identicon)[moehakram](/maintainers/moehakram)

---

Top Contributors

[![moehakram](https://avatars.githubusercontent.com/u/105730626?v=4)](https://github.com/moehakram "moehakram (1 commits)")

### Embed Badge

![Health badge](/badges/moehakram-webphp-oop/health.svg)

```
[![Health](https://phpackages.com/badges/moehakram-webphp-oop/health.svg)](https://phpackages.com/packages/moehakram-webphp-oop)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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