Skip to content

unicframework/docs

Repository files navigation

Unic Framework

Unic Logo

Unic is a high performance, open source web application framework. Unic framework is fast, minimal and unopinionated web framework inspired by express. Unic is simple and flexible and provide lots of features to create apis and web application quickly.

Features

  • Fast and flexible.
  • Extremely light weight.
  • Minimal and unopinionated.
  • Simple and robust routing.
  • Robust middlewares.

User Guide

Simple Example

A simple Hello, World web application in unic framework.

use Unic\App;

$app = new App();

$app->get('/', function($req, $res) {
    $res->send('Hello, World!');
});

$app->get('/api', function($req, $res) {
    $res->json([
        'status' => 'Ok',
    ]);
});

$app->start();

OpenSwoole Example

A simple Hello, World web application in unic framework using OpenSwoole server.

use Unic\App;
use OpenSwoole\Http\Server;

$app = new App();
$server = new Server("127.0.0.1", 3000);

$app->get('/', function($req, $res) {
    $res->send('Hello, World!');
});

$app->get('/api', function($req, $res) {
    $res->json([
        'status' => 'Ok',
    ]);
});

$app->useOpenSwooleServer($server);
$app->start();

Run OpenSwoole app:

php server.php

It will start openswoole server at localhost

License

MIT License