Coder Social home page Coder Social logo

biny's Introduction

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也是可以的。简写示例:

<?php echo $string;?> => <?=$string?>

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:

<?php echo $string;?> => <?=$string?>

biny's People

Contributors

billge1205 avatar idoubi avatar kevinkaske avatar shigemorihakura avatar sn01615 avatar tianhe1986 avatar tiltysola avatar yinggaozhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

biny's Issues

Biny里面能不能出个API授权机制

最近想开放一些接口让外部网站调用,但是不知道接口怎么写好些,比如身份认证,请求时间、次数限制,接口访问权限控制,不同身份的请求只能访问与之对应的接口,大神能不能在biny里面写一个让我参考下啊。。

测试代码就不要出现在项目里了吧…

项目里似乎有很多测试的代码,总不能我们在用的时候,还需要去自己删除这部分代码吧。虽然这部分代码,有助于我们使用框架。但是,我觉得文档已经写的很详细啦🤣🤣🤣

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

默认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()方法,并且同时支持两层路由的访问

jquery error and scrollspy error

when i download the src code from github and try to run it ,it show error info that jquery is not defined and scrollspy id not defined.in demo.tpl.php

请问一下Service的用法是怎样的

从demo中的loginAction,操作数据库是直接调用DAO。而privilegeService感觉更像是横切的一个通用业务逻辑层。能否稍稍讲解一下Service的用法。

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

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

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

`

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

模板渲染问题

/lib/business/TXResponse.php中的这段代码读取缓冲区内容不稳定,导致前端页面渲染失败:

        ob_start();
        //include template
        $lang = TXLanguage::getLanguage();
        $file = sprintf('%s/template/%s%s.tpl.php', TXApp::$app_root, $this->view, $lang ?'.'.$lang : "");
        if (!is_readable($file)){
            $file = sprintf('%s/template/%s.tpl.php', TXApp::$app_root, $this->view);
        }
        if (!is_readable($file)){
            throw new TXException(2005, $this->view);
        }
        include $file;
        TXLogger::showLogs();

        $content = ob_get_clean();
        return $content;

1

TXService 思路不友好

TXService 工厂DAO 写法对 IDE 很不友好,开发会带来很多麻烦。不像静态语言可以定义类型,这种设计有点蹩脚

composer 支持

感谢开源这么一个高性能的php框架.
看了一遍,发现不支持composer?这样的话很多php生态圈的库引用起来比较麻烦了.

我这里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
希望您能给些建议或指导,谢谢啦。

不支持url中index.php访问?

必须实现重写,去掉index.php才能使用吗?
我试了如果不重写,哪怕只访问domain/index.php也出错;
即使做了重写,如果url中有index.php也会报错

关于权限 privilege,错误能不显示吗?

Fatal error:  privilege [login_required] is not access [非法请求] in D:\htdocs\chatWeb\lib\business\TXAction.php:123
Stack trace:
#0 D:\htdocs\chatWeb\lib\business\TXAction.php(79): biny\lib\TXAction->valid_privilege()
#1 D:\htdocs\chatWeb\lib\business\TXFactory.php(68): biny\lib\TXAction->__construct()
#2 D:\htdocs\chatWeb\lib\business\TXFactory.php(45): biny\lib\TXFactory::loadClass('adminAction', 'adminAction')
#3 D:\htdocs\chatWeb\lib\business\TXRequest.php(232): biny\lib\TXFactory::create('adminAction')
#4 D:\htdocs\chatWeb\lib\business\TXController.php(54): biny\lib\TXRequest->getModule(true)
#5 D:\htdocs\chatWeb\lib\business\TXController.php(42): biny\lib\TXController->call(Object(biny\lib\TXRequest))
#6 D:\htdocs\chatWeb\lib\business\TXController.php(105): biny\lib\TXController->execute()
#7 D:\htdocs\chatWeb\lib\TXApp.php(177): biny\lib\TXController->dispatcher()
#8 D:\htdocs\chatWeb\web\index.php(21): TXApp::run()
#9 {main}

这个错误信息能不显示吗?

建议--结合下swoole

大概看了下框架的代码结构,加入swoole的话,改动不是很大。性能还会有一个量级的提升

关于privilegeService的一些使用疑问

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

Readme in English

Hello,
Your framework appears in Github trending repositories and seems quite interesting. Could you please provide a Readme file in English or another European language?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.