V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
doyouhaobaby
V2EX  ›  PHP

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

  •  
  •   doyouhaobaby · 2018-12-11 10:11:33 +08:00 · 2250 次点击
    这是一个创建于 1934 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   964 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 21:53 · PVG 05:53 · LAX 14:53 · JFK 17:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.