Biny is a tiny, high-performance PHP framework for web applications

Overview

Biny

license Release Version PRs Welcome

Biny是一款高性能的轻量级PHP框架

遵循 MVC 模式,用于快速开发现代 Web 应用程序

Biny代码简洁优雅,对应用层,数据层,模板渲染层的封装简单易懂,能够快速上手使用

高性能,框架响应时间在1ms以内

Biny is a high performance lightweight PHP framework.

It follows the MVC pattern for rapid development of modern Web applications

Biny code is simple and elegant. The application layer, data layer, and template rendering layer of the package is simple and easy to understand. This makes it quick to pick up.

Biny is high performance. Framework comes default with response time of less than 1ms. Stand-alone QPS easily up to 3000.

功能介绍 Function introduction

支持跨库连表,条件复合筛选,查询PK缓存等

支持RESTful,类的自动化加载管理

支持Form表单验证,支持事件触发机制

支持浏览器端调试,快速定位程序问题和性能瓶颈

具有sql防注入,html自动防xss等特性

Support cross library join table, conditional compound filter, query PK cache, etc.

Supports RESTful, automatic loading management of classes

Supports Form validation and supports event triggering mechanisms

Supports browser side debugging, rapid positioning problems and performance bottlenecks

With SQL anti injection, HTML automatic anti XSS and other characteristics

使用文档 documents

Wiki URL:http://www.billge.cc

English Wiki URL:http://www.billge.cc?lang=en

GitHub URL:https://github.com/Tencent/Biny

FAQ

Q: 框架跟传统PHP框架区别在哪儿,有什么优势?

A: Biny是个自由度很高的框架,不像其他框架需要配置各种路由,依赖外部组件。这些在Biny中都是不需要的,按照一个简单的规则就能快速使用这些功能。同时框架已集成了自动加载机制,从开发者的角度出发,在功能上使用非常简单。而且具有相当强的安全性。从框架层面完全屏蔽了 SQL注入和 XSS注入两大安全难题,非常适合新人使用。

Q: Biny框架的性能如何?

A: 测试机:Intel Xeon Processor E5506 (4M Cache, 2.13 GHz, 4.80 GT/s Intel QPI) 一个普通查询数据页面(50%命中缓存)QPS 能轻松达到3000以上,同比Yii,性能是Yii的2倍以上。

Q: 我想使用Biny,请问有相关说明文档吗?

A: 文档都在http://www.billge.cc

Q: Biny框架适配PHP7吗?

A: 可以完美运行,性能提高2倍以上。

Q: Biny现在是最终版了吗,还会继续更新吗?

A: 目前版本在多个项目中已经正常使用,相对成熟。后续会针对性能和功能上都会持续更新,届时只需更新替换 lib库 即可使用最新框架。

Q: What is the difference between a framework and a traditional PHP framework? What are the advantages?

A: Biny is a framework with high degree of freedom, unlike other frameworks that need to configure various routes, relying on external components. These are unnecessary in Biny and can be quickly used with simple rules. At the same time, the framework has been integrated with the autoload mechanism. From the developer's point of view, the functionality is very simple to use. It defaults to strong security. From the framework level, the applications is completely shielded from SQL injection and XSS injection.

Q: What is the performance of the Biny framework?

A: Testing machine: Intel Xeon Processor E5506 (4M Cache, 2.13 GHz, 4.80 GT/s Intel QPI) A common query data page (50% hit cache), QPS can easily reach more than 3000. This is twice as fast as Yii.

Q: Does the Biny framework work with PHP7?

A: Yes. Performance increases have been seen of over 2x when compared with PHP5.

Q: Is Biny the final version now? Will it continue to be updated?

A: The current version has been used in several projects and is relatively mature. The follow-up will be updated for both performance and functionality, and you'll need to update and replace the Lib library to use the latest framework.

常见问题 Common Problems

Q:模版渲染出现错乱是为什么

A:请在php.ini中打开short_open_tag。Biny的示例中使用了PHP中原生的简写渲染方法,需要将系统配置中的简写配置打开才能正常使用。 当然如果是自己开发的模版页面,不用简写方式的话,就算不打开short_open_tag也是可以的。简写示例:

 => 

Q:Why is the template rendering deranged?

A:Please open short_open_tag in php.ini. In the example of Biny, you use the native abbreviated rendering method in PHP, and you need to open the short configuration in the system configuration for normal use. Of course, if you are developing your own template page, you don't need to abbreviate it, even if you don't open the short_open_tag. Abbreviated example:

 => 
Comments
  • 路由怎么写都不对…… 问题出在哪里了

    路由怎么写都不对…… 问题出在哪里了

    //config/config.php 中写道 'routeRule' => array( 'demo' => 'demo', 'demo.html' => 'demo', '/demo/'=>'demo', ),

    //访问 http:///demo/ or http:///demo.html 都不对,显示404 求正解!

    opened by cwwjsyc 8
  • 我这里class TXDAO里面的function update的一个bug

    我这里class TXDAO里面的function update的一个bug

    您好, 近期在用Biny做一个项目, 不知是php.ini的原因还是什么原因,在类TXDAO里面的函数update中的如下语句 $params = func_get_args(); 在$params[1]中没有传进来TXCond实例,导致最终执行的sql没有加上where条件。

    例如我在baseModel类中执行的是$this->DAO->updateByPk(1, ['del'=>1]); 期望执行update client set del=1 where id=1 结果执行update client set del=1

    调查发现TXCond中的如下函数已经传了$this了,不知为什么调用func_get_args()取参数时并没有接收到这个object参数。我试了一下,如果是$args[] = 123;啥的是可以传过去的。 public function __call($method, $args) { if (in_array($method, $this->methods) || in_array($method, $this->calcs)){ $args = $args ? $args : ['']; $args[] = $this; return call_user_func_array([$this->DAO, $method], $args); } else { throw new TXException(3009, [$method, CLASS]); } } 我的执行环境是 nginx/1.12.1 PHP/7.1.9 希望您能给些建议或指导,谢谢啦。

    opened by hecomlilong 6
  • 添加namespace后,自动加载类失败

    添加namespace后,自动加载类失败

    比如我在controller文件夹下面添加一个文件夹client, 然后在client文件夹下创建一个customerAction类customerAction.php 并继承baseAction, 文件最上面写namespace app\controller\client; 并且加上use app\controller\baseAction 例如

    opened by hecomlilong 4
  • 同级Serveice无法相互调用

    同级Serveice无法相互调用

    questsService中无法调用gameplayService中的方法。

    命名空间: namespace app\service;

    代码: $total = $this->gameplayService->get($this->$member['id']);

    错误Stack:

    Fatal error:  System Error [Uncaught Error: Call to a member function get() on null in app/service/questsService.php:54
    Stack trace:
    #0 app/controller/questsAction.php(47): app\service\questsService->quest_able_accomplish('1')
    #1 [internal function]: app\controller\questsAction->action_quest_submit()
    #2 lib/business/TXController.php(69): call_user_func_array(Array, Array)
    #3 lib/business/TXController.php(42): biny\lib\TXController->call(Object(biny\lib\TXRequest))
    #4 lib/business/TXController.php(105): biny\lib\TXController->execute()
    #5 lib/TXApp.php(177): biny\lib\TXController->dispatcher()
    #6 web/index.php(21): TXApp::run()
    #7 {main}
      thrown] in lib/TXApp.php:156
    Stack trace:
    #0 [internal function]: TXApp::handleFatalError()
    #1 {main}
    
    opened by AlishaHawkward 3
  • 问下TXEvent::one(onSql);这个方法为什么用不了,还有左联表相同字段数据覆盖问题

    问下TXEvent::one(onSql);这个方法为什么用不了,还有左联表相同字段数据覆盖问题

    `<?php namespace app\controller;

    class testAction extends baseAction { //默认路由index public function action_index() { $DAO = $this->modsDAO; TXEvent::one(onSql); $DAO = $DAO->leftJoin($this->mods_typeDAO,array('mods_type_id'=>'id'))->query();//左联接mods_type return $this->display('main/test', array('test'=>1), array('path'=>$DAO)); } }` ?> 报错如下: Fatal error: Autoload file[app\controller\TXEvent] is fails in D:\wamp64\www\biny\lib\TXAutoload.php:116 Stack trace: #0 [internal function]: biny\lib\TXAutoload::load('app\controller\...') #1 D:\wamp64\www\biny\app\controller\testAction.php(11): spl_autoload_call('app\controller\...') #2 [internal function]: app\controller\testAction->action_index() #3 D:\wamp64\www\biny\lib\business\TXController.php(69): call_user_func_array(Array, Array) #4 D:\wamp64\www\biny\lib\business\TXController.php(42): biny\lib\TXController->call(Object(biny\lib\TXRequest)) #5 D:\wamp64\www\biny\lib\business\TXController.php(105): biny\lib\TXController->execute() #6 D:\wamp64\www\biny\lib\TXApp.php(177): biny\lib\TXController->dispatcher() #7 D:\wamp64\www\biny\web\index.php(21): TXApp::run() #8 {main}

    主要在左联其他数据表的时候如果主表有和左联表有相同名称字段.比如两个表都有id字段.查询后输出的id为左联表的id,而不是主表的id.想看下sql调试结果发现也没法调试.

    opened by coolsharkll 3
  • 额,我又来提问了,大神帮我看看这是怎么回事

    额,我又来提问了,大神帮我看看这是怎么回事

    `

    Fatal error:  System Error [PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pdo_mysql.dll' - /usr/lib/php/20151012/php_pdo_mysql.dll: cannot open shared object file: No such file or directory] in /home/kang/product/kwms/lib/TXApp.php:153
    --
      | Stack trace:
      | #0 [internal function]: TXApp::handleFatalError()
      | #1 {main}
    
    `
    
    有时候刷新一下页面,在页面的最底部会现这个,然后在刷新一下就又没有了,请问这是怎么回事啊,是不是我的环境配置有问题。
    Apache/2.4.18 (Ubuntu)
    php 7.0.22
    mysql  5.7.20-0ubuntu0.16.04.1
    
    		                                  
    		                                    
    	                                    
    opened by Kavf 3
  • 请问大神,如何将路由的层数扩展到三层。

    请问大神,如何将路由的层数扩展到三层。

    默认biny的的路由只有两层 当访问https://biny.com/article/add时 实际访问的是/app/controller/article/addAction.php文件下的action_add()方法 我想在路由上面多加一层以区分前台后台,但路由貌似不支持: 当访问 https://biny.com/admin/article/add时会提示找不到action_article()方法 能不能有什么办法可以访问到/app/controller/admin/article/addAction.php这个文件下的action_add()方法,并且同时支持两层路由的访问

    opened by Kavf 3
  • 关于privilegeService的一些使用疑问

    关于privilegeService的一些使用疑问

    我打算使用privilegeService做一些类似前置拦截器的功能(验证每个ajax请求的token),自定义的验证方法(// privilegeService.php)返回false时,我注意到只是call_user_func_array,那么callback做什么好像都影响不到整个流程,没有else甚至会直接throw 6001。就我的使用流程来看貌似是这样的

    opened by lordGuan 3
  • 使用 axios 发送POST 请求时,无法正常接收到数据

    使用 axios 发送POST 请求时,无法正常接收到数据

    ts 请求代码 function GetUser() { axios.post("/render/GetUser", { user: "111" }).then((res: any) => { console.log(res); }) }

    PHP接收代码 public function action_GetUser(){ $user = $this->request->post("user"); $this->json([ "code"=>"00", "user"=>$user ]); }

    请求返回 {"code":"00","user":null}

    QQ截图20220811113747 QQ截图20220811113804 QQ截图20220811113908 QQ截图20220811113917

    opened by 3DMXM 2
  • Biny中如何将Token添加到请求头Header中?

    Biny中如何将Token添加到请求头Header中?

    类似这样:

    Request Headers authorization:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzc28uY29vbCIsImlhdCI6MTYxMTA1MDY1OSwiZGF0YSI6eyJ1c2VyaWQiOjF9LCJzY29wZXMiOiJyb2xlX2FjY2VzcyIsImV4cCI6MTYxMTA1Nzg1OX0.c8qvPS1lHrk6GuCnU2a4XUnThuzkoowKH2nKCZZE7Vk

    现在在做统一登录,登陆后将token放到请求头,老师能给个思路吗?

    opened by gmplato 3
Releases(v2.10.10)
Owner
Tencent
Tencent
High performance, full-stack PHP framework delivered as a C extension.

Phalcon Framework Phalcon is an open source web framework delivered as a C extension for the PHP language providing high performance and lower resourc

The Phalcon PHP Framework 10.6k Sep 30, 2022
High-Performance Long-Living PHP Framework for modern enterprise application development

Documentation · Discord · Telegram · Twitter Spiral Framework is a High-Performance Long-Living Full-Stack framework and group of over sixty PSR-compa

Spiral Scout 1.3k Sep 27, 2022
High performance HTTP Service Framework for PHP based on Workerman.

webman High performance HTTP Service Framework for PHP based on Workerman. Manual https://www.workerman.net/doc/webman Benchmarks https://www.techempo

walkor 1.2k Sep 27, 2022
🔥High Performance PHP Progressive Framework.

The Core Framework English | 中文 The QueryPHP Application QueryPHP is a modern, high performance PHP progressive framework, to provide a stable and rel

The QueryPHP Framework 306 Sep 20, 2022
Motan - a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services

Motan-PHP Overview Motan is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.

Weibo R&D Open Source Projects 79 Sep 17, 2022
💾 High-performance PHP application server, load-balancer and process manager written in Golang. RR2 releases repository.

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Spiral Scout 44 Sep 21, 2022
🤯 High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Spiral Scout 6.7k Sep 28, 2022
A tiny, yet powerful, PHP micro-framework.

Equip Framework A tiny and powerful PHP micro-framework created and maintained by the engineering team at When I Work. Attempts to be PSR-1, PSR-2, PS

Equip 118 Jun 24, 2022
This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

Swoole Taiwan 3.9k Sep 12, 2022
PIP is a tiny application framework built for people who use a LAMP stack.

PIP is a tiny application framework built for people who use a LAMP stack. PIP aims to be as simple as possible to set up and use.

Ron Marasigan 246 May 21, 2022
FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Ruby on Rails.

FlyCubePHP FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Rub

Anton 1 Dec 21, 2021
Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X – the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

Christian Lück 568 Sep 20, 2022
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

Slim Framework Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs. Installation It's recommended

Slim Framework 11.4k Sep 23, 2022
A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast! Condensed in a single ~65KB file

Bong Cosca 2.6k Sep 25, 2022
Woski is a fast and simple lightweight PHP Framework for building applications in the realm of the web.

Woski is a simple fast PHP framework for the Realm The Project Installation Clone the repository $ composer create-project clintonnzedimma/woski myApp

Clinton Nzedimma 19 Aug 15, 2022
TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs.

TrailLamp Introduction TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs. Installatio

Etorojah Okon 14 Jun 10, 2022
A Small modular PHP framework Build for web applications

MagmaCore__ This project is in active development. So is evolving constantly. As soon project gets to stable point. Due notice will be given Composer

Ricardo Miller 10 Sep 2, 2022
Elgg is an open source rapid development framework for socially aware web applications.

Elgg Elgg is an open source rapid development framework for socially aware web applications. Features Well-documented core API that allows developers

Elgg 1.5k Sep 19, 2022
Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.

Zephir - is a high level programming language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C c

Zephir Language 3.1k Sep 23, 2022