Leevel v1.0.0-alpha.2 发布,基于 zephir 高性能 PHP 扩展开发框架

  

Leevel 是一个开源 PHP C 扩展开发框架,采用 zephir 编写,是为了解决使用框架带来性能下降的经典矛盾,Leevel 是为了解决 QueryPHP 性能而开发,可以与同版本的 QueryPHP 混合使用,将接管 composer 中的 PHP 版本功能。

存在的意义?

Leevel 和 QueryPHP 一般配合使用,基本上不会推荐单独使用,一句话就是替代部分 QueryPHP 中的功能。


单独使用可以作为一个库来使用,性能还是不错的。可以配合 Yaf 使用,Leevel 提供了 缓存,IOC 容器,日志,Session 等。

更新日志

本次版本的发布主要是随着 QueryPHP 对应着一个基于 IView 的通用权限系统做了一些调整,更新记录见下面的 URL。

hunzhiwange/leevel

  • 修正一处集合的 BUG

  • 完善 leevel/support/type.zep 返回值类型

  • Restful 路由没有参数时为首页 index 而不是 show

  • 删除兼容获取 pathInfo 的获取方法 ?_url=xx,由 Nginx 可以做到

  • 对 axios 等前端提交类型 application/json 时自动处理表单数据

  • 加入一个环境变量 RUNTIME_ENVIRONMENT,利于更好地处理单元测试载入不同的配置文件

安装方法

Windows

后续会提供 dll 扩展.

Linux

从下面的仓库下载源代码.

git clone [email protected]:hunzhiwange/leevel.git
cd ext

GCC 编译源码.

$/path/to/phpize
$./configure --with-php-config=/path/to/php-config
$make && make install

将扩展添加到你的 php.ini, 使用 php -m 查看扩展是否被安装.

extension = leevel.so

运行测试文件

$cd /data/codes/leevel    
$composer install
$cp ./tests/config.php ./tests/config.local.php // Modify the config
$php vendor/bin/phinx migrate
$php vendor/bin/phpunit tests

使用例子

例如 ioc 容器使用方法。

<?php

use Leevel\Di\Container;

$container = new Container();
$container->instance('foo', 'bar');
var_dump($container->make('foo')); // bar

猜你喜欢

转载自www.oschina.net/news/102590/leevel-1-0-0-alpha2