• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

igniphp/framework: Swoole, PSR-15, PSR-7, PSR-11 lightweight modular anti-framew ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

igniphp/framework

开源软件地址:

https://github.com/igniphp/framework

开源编程语言:

PHP 100.0%

开源软件介绍:

Igni logo

License: MIT Build Status Scrutinizer Code Quality Code Coverage

Igni is a php7 anti-framework with built-in swoole server and modular architecture support to help you quickly write scalable PSR-7 and PSR-15 compilant REST services.

Its main objective it to be as much transparent and as less visible for your application as possible.

<?php
require 'vendor/autoload.php';

use Igni\Application\Config;
use Igni\Application\HttpApplication;
use Igni\Application\Providers\ConfigProvider;
use Igni\Network\Http\Response;
use Igni\Network\Http\Request;

$application = new HttpApplication();

// Routing
$application->get('/hello/{name}', function (Request $request) : Response {
    return Response::asText("Hello {$request->getAttribute('name')}.");
});

// Middleware - no interfaces no binding with framework code is required in order things to work.
$application->use(function($request, /** callable|RequestHandlerInterface */$next) {
    $response = $next($request);
    return $response->withAddedHeader('Version', $this->getConfig()->get('version'));
});

// Extending application is a brief just create and implement methods for your needs.
$application->extend(new class implements ConfigProvider {
    public function provideConfig(Config $config): void {
        $config->set('version', '1.0');
    }
});

$application->run();

Installation and requirements

Recommended installation way of the Igni Framework is with composer:

composer install igniphp/framework

Requirements:

  • php 7.1 or better
  • swoole extension for build-in http server support

What's new

With version 2.0 network package was extracted from the framework code, error handling was overall improved as well as Server's listeners. More details can be found in changelog file.

Quick start

Alternatively you can start using framework with quick start which contains bootstrap application.

Features

Routing

Igni router is based on very fast symfony routing library.

PSR-7, PSR-15 Support

Igni fully supports PSR message standards for both manipulating http response, request and http middlwares.

Dependency Injection and Autoresolving

Igni autoresolves dependencies for you and provides intuitive dependency container. It also allows you to use any PSR compatible container of your choice.

Modular architecture

Modular and scalable solution is one of the most important aspects why this framework was born. Simply create a module class, implement required interfaces and extend application by your module.

Performant, production ready http server

No nginx nor apache is required when swoole is installed, application can be run the same manner as in node.js world:

php examples/build_in_server_example.php

Igni's http server is as fast as express.js application with almost 0 configuration.

Detailed documentation

Detailed documentation and more examples can be found here and in examples directory.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap