PHPackages                             minisolid/minisolid - 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. minisolid/minisolid

ActiveLibrary[Framework](/categories/framework)

minisolid/minisolid
===================

PHP mini webframework for handle reqest and response with no dependency

00PHP

Since Dec 20Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Here's an open-source README for the project named **MiniSolid**:

---

**MiniSolid**
=============

[](#minisolid)

[![MiniSolid Logo](https://camo.githubusercontent.com/cae537669677ec32be5e23804375c75c0452ed0ec53fdc94cada2b5d683f8a36/68747470733a2f2f696d672e69636f6e73382e636f6d2f696f732f3435322f7068702e706e67)](https://camo.githubusercontent.com/cae537669677ec32be5e23804375c75c0452ed0ec53fdc94cada2b5d683f8a36/68747470733a2f2f696d672e69636f6e73382e636f6d2f696f732f3435322f7068702e706e67)

**MiniSolid** is a lightweight, flexible PHP framework designed for simplicity, modularity, and extensibility. It brings powerful features such as **Dependency Injection (IoC Container)**, **Middleware Pipelines**, **Routing with Annotations**, and both **Web &amp; API Controllers** to help you build modern web applications with minimal effort. Built with **SOLID principles** in mind, it promotes clean code, separation of concerns, and scalability.

---

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

[](#table-of-contents)

- [**MiniSolid**](#minisolid)
    - [**Table of Contents**](#table-of-contents)
    - [**Features**](#features)
    - [**Installation**](#installation)
    - [**Usage**](#usage)
    - [**Directory Structure**](#directory-structure)
    - [**Routing**](#routing)
    - [**Controllers**](#controllers)
        - [**Web Controller**:](#web-controller)
        - [**API Controller** (returns JSON responses):](#api-controller-returns-json-responses)
    - [**Responses**](#responses)
        - [**Web Response**:](#web-response)
        - [**API Response**:](#api-response)
        - [**Error Response**:](#error-response)
    - [**Middleware**](#middleware)
    - [**Extending MiniSolid**](#extending-minisolid)
        - [**1. Adding Services**](#1-adding-services)
        - [**2. Adding Custom Middleware**](#2-adding-custom-middleware)
        - [**3. Use Database**](#3-use-database)
    - [**Contributing**](#contributing)
    - [**License**](#license)
        - [**Ready to Get Started?**](#ready-to-get-started)

---

**Features**
------------

[](#features)

- **SOLID Principles**: Follows clean code principles to ensure your application is scalable and maintainable.
- **IoC Container**: Easily manage services and their dependencies with automatic dependency injection.
- **Annotation-Based Routing**: Define your routes directly in controller methods using simple annotations.
- **API &amp; Web Controllers**: Separate logic for API responses (JSON) and traditional web views (HTML).
- **Middleware**: Add reusable middleware for tasks like logging, authentication, and request validation.
- **Fluent Builder API**: Simple, chainable API to configure your application with minimal boilerplate.

---

**Installation**
----------------

[](#installation)

You can install **MiniSolid** using Composer, the de facto dependency manager for PHP.

1. **Install Composer** (if you haven’t already): [Get Composer](https://getcomposer.org/download/)
2. **Install MiniSolid via Composer**: In your project directory, run the following command:

    ```
    composer require vicheanath/minisolid
    ```

    Alternatively, you can clone this repository and install the dependencies manually:

    ```
    git clone https://github.com/vicheanath/minisolid.git
    cd minisolid
    composer install
    ```

---

**Usage**
---------

[](#usage)

1. **Create a New Project**: To start using **MiniSolid**, set up the following directory structure in your project:

    ```
    /app
      /Controllers
    /public
      index.php
    /views
    /vendor
    composer.json

    ```
2. **Configure the Application**: In `public/index.php`, you can configure the app to load controllers, routes, and middleware:

    ```
    require_once __DIR__ . '/../vendor/autoload.php';

    use MiniSolid\ApplicationBuilder;
    use App\Controllers\HomeController;
    use App\Controllers\UserController;

    // Create and configure the application
    $app = new ApplicationBuilder();

    // Register routes and middleware
    $app->routes(function ($router) {
        $router->registerRoutes(HomeController::class);
        $router->registerRoutes(UserController::class);
    });

    // Run the application
    $app->run();
    ```
3. **Start the Server**: Run PHP's built-in server:

    ```
    php -S localhost:8000 -t public
    ```
4. **Visit in Browser**:

    - `http://localhost:8000/` → Web page
    - `http://localhost:8000/api/users` → API response (JSON)

---

**Directory Structure**
-----------------------

[](#directory-structure)

Here is the typical directory structure for a **MiniSolid** project:

```
/app
  /Controllers
    HomeController.php
    UserController.php
/public
  index.php
/views
  home.php
  about.php
/tests
  IoCContainerTest.php
  UserControllerTest.php
/vendor
  Composer dependencies
composer.json
phpunit.xml
README.md
LICENSE

```

- **/app**: Contains all your controllers, services, and logic.
- **/public**: The entry point for your web server (usually `index.php`).
- **/views**: The directory where your views (HTML) are stored.
- **/tests**: Contains your PHPUnit tests.
- **/vendor**: Composer dependencies.

---

**Routing**
-----------

[](#routing)

Define routes in controller methods using **annotations** like so:

```
namespace App\Controllers;

use MiniSolid\ControllerBase;

class HomeController extends ControllerBase {
    /**
     * @Route("/", method="GET")
     */
    public function index() {
        $this->view('home', ['title' => 'Welcome to MiniSolid']);
    }

    /**
     * @Route("/about", method="GET")
     */
    public function about() {
        $this->view('about', ['title' => 'About Us']);
    }
}
```

In your `ApplicationBuilder`, register routes as follows:

```
$app->routes(function ($router) {
    $router->registerRoutes(HomeController::class);
});
```

---

**Controllers**
---------------

[](#controllers)

### **Web Controller**:

[](#web-controller)

```
namespace App\Controllers;

use Mini\Solid\Controller;

class HomeController extends Controller {
    /**
     * @Route("/", method="GET")
     */
    public function index() {
        $this->view('home', ['title' => 'Welcome to MiniSolid']);
    }
}
```

### **API Controller** (returns JSON responses):

[](#api-controller-returns-json-responses)

```
namespace App\Controllers;

use Mini\Solid\ApiController;

class UserController extends ApiController {
    /**
     * @Route("/api/users", method="GET")
     */
    public function getUsers() {
        $users = [
            ['id' => 1, 'name' => 'Alice'],
            ['id' => 2, 'name' => 'Bob'],
        ];
        $this->json($users);
    }

    /**
     * @Route("/api/users", method="POST")
     */
    public function createUser() {
        $data = $this->request->body;

        if (empty($data['name'])) {
            $this->error('Name is required', 422);
        } else {
            $this->json(['message' => 'User created', 'data' => $data], 201);
        }
    }
}
```

---

**Responses**
-------------

[](#responses)

MiniSolid handles responses for both web and API controllers:

### **Web Response**:

[](#web-response)

Render an HTML view:

```
$this->view('home', ['title' => 'Home']);
```

### **API Response**:

[](#api-response)

Return JSON data:

```
$this->json(['message' => 'Success']);
```

### **Error Response**:

[](#error-response)

Return error messages for APIs:

```
$this->error('An error occurred', 500);
```

---

**Middleware**
--------------

[](#middleware)

Add custom middleware to handle cross-cutting concerns such as logging or authentication:

```
$app->middleware(function ($pipeline) {
    $pipeline->add(function ($request, $response, $next) {
        header('X-Powered-By: MiniSolid');
        return $next($request, $response);
    });
});
```

---

**Extending MiniSolid**
-----------------------

[](#extending-minisolid)

### **1. Adding Services**

[](#1-adding-services)

Register custom services in the IoC container:

```
$container->register(App\Contracts\UserRepository::class, App\Repositories\MySQLUserRepository::class);
```

### **2. Adding Custom Middleware**

[](#2-adding-custom-middleware)

Add middleware for tasks like authentication:

```
$pipeline->add(function ($request, $response, $next) {
    if (!isset($request->headers['Authorization'])) {
        return Response::json(['error' => 'Unauthorized'], 401);
    }
    return $next($request, $response);
});
```

### **3. Use Database**

[](#3-use-database)

To integrate a database, register a database connection service and inject it into controllers or services:

```
$container->register(App\Contracts\DatabaseInterface::class, App\Database\MySQLConnection::class);
```

---

**Contributing**
----------------

[](#contributing)

We welcome contributions! To get started:

1. Fork the repository.
2. Create a new feature branch.
3. Add tests for your changes.
4. Submit a pull request.

---

**License**
-----------

[](#license)

MiniSolid is licensed under the [MIT License](LICENSE).

---

### **Ready to Get Started?**

[](#ready-to-get-started)

- **Explore MiniSolid**: Dive into the framework and start building your next PHP application with ease!
- **Contribute**: Have an idea or improvement? Contribute to this project and help others!

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

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/0f509f3bdc2fd510c2ec887b282a948fb976709fb80b04ce9319431201437472?d=identicon)[vicheanath](/maintainers/vicheanath)

---

Top Contributors

[![vicheanath](https://avatars.githubusercontent.com/u/48352653?v=4)](https://github.com/vicheanath "vicheanath (13 commits)")

### Embed Badge

![Health badge](/badges/minisolid-minisolid/health.svg)

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

###  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)
