Framework
Tencent/Biny avatar
Tencent/Biny

Tencent Biny: a lightweight PHP MVC framework with built-in protections

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

1,681 stars253 forksPHPBSD-3-Clause

At a glance

What is it?
Tencent Biny is a compact MVC framework for PHP web developers who want routing, data access, templates, validation, events, caching, and security handling through conventions. Its main drawback is that the README sends application setup and much of its operation to an external Wiki.
Who is it for?
Developers who want a small MVC layer, built-in SQL and XSS defenses, and compatibility across PHP 7.x and PHP 8.x may find Biny suitable after checking the external Wiki and application conventions. Projects that require a documented installer, current integration standards, or extensive deployment guidance should wait until the project supplies those details.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 60 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Biny's place in PHP web application development

Tencent Biny addresses developers who want MVC structure without assembling several separate libraries before building an application. Its README describes a compact framework for application logic, database access, and template rendering, with conventions intended to reduce route configuration and dependency setup. The intended audience includes PHP developers who value a small framework layer and integrated safeguards, including developers moving from procedural PHP or from a framework whose conventions do not fit their application.

The repository contains `app/`, `config/`, `lib/`, `web/`, `tests/`, `docs/`, and `extends/`. This is a conventional PHP project layout with framework code, application code, configuration, a web-facing directory, tests, documentation, and extensions. Its topics include MVC, PHP, web applications, and XSS protection. Based on that layout, Biny is more than a routing class, although the README does not document a complete request lifecycle.

Biny covers common server-side functions without requiring a broad framework ecosystem. The README lists RESTful routing, automatic class loading, form validation, event triggering, browser debugging, primary-key query caching, compound filtering, and cross-database joins. These features matter when an application needs a clear MVC boundary but does not require a larger framework or separate packages for each foundation capability.

The repository is not archived, and the last push was on 2026-08-24. Version `v2.11.0` was released on the same date, following releases from 2023-01-29 and 2021-06-28. This establishes recent repository activity, but it does not by itself establish a release schedule, long-term support policy, or API stability guarantee.

Biny's MVC request and data-handling model

Biny follows MVC and separates application, data, and template-rendering responsibilities. The README does not include a controller, route definition, model class, or request object, so the exact dispatch sequence remains undocumented there. Its stated design indicates that routing sends an HTTP request into application code, the data layer handles database operations, and the template layer renders the response.

The data capabilities are more specific. Biny supports compound conditional filtering and cross-database `JOIN` operations, allowing a query to span databases instead of being restricted to a single connection. It also supports primary-key query caching. The README does not document cache invalidation, serialization, storage backends, or consistency rules. Those omissions matter for applications whose records change frequently.

RESTful routing and automatic class loading are built into the framework rather than presented as dependencies that must be selected separately. Form validation and an event-trigger mechanism cover two additional application boundaries. The extension documentation identifies `beforeAction` events as a place to add authentication, including authentication for a front-end and back-end separation architecture.

Since version `v2.11.0`, the `App::bind()` registry can mount third-party components without changing framework core. The README gives Kafka as an example, while separate documents cover MongoDB and `firebase/php-jwt`. This extension mechanism acts like a small application registry: code registers a named factory, and application code retrieves the resulting service through `App::$base`. It keeps integrations outside Biny's own MVC internals.

Security boundaries in Biny's SQL and HTML handling

Biny advertises SQL injection prevention and automatic HTML XSS escaping at the framework layer. Those are material reasons to consider it for applications that process submitted data or render user-controlled values. The README does not describe the escaping functions, query parameterization, output encoding rules, or exceptions to automatic handling, so the implementation must be checked in source and application code.

The documented security scope is SQL injection and XSS handling. Biny does not claim in the README to supply CSRF protection, authentication, authorization, cookie security, Content Security Policy headers, or secure file-upload handling. A project requiring those controls should not treat the two documented protections as a complete web security model.

Version `v2.11.0` also changed the framework's PHP compatibility position. The README says this release fixed PHP 8 compatibility problems and several security vulnerabilities, with details in `CHANGELOG.md`. It recommends PHP 8.1 or later while retaining PHP 7.x compatibility. An existing application still needs to review its PHP extensions and dependencies before switching runtimes.

The browser debugging feature requires similar care. The README presents it as a way to locate program issues and performance bottlenecks, but it does not document access control or whether debugging output is disabled by default. The Wiki should be checked before exposing a production application.

Obtaining Biny and preparing a first PHP use

The README does not provide a complete Composer installation command, scaffold command, or first-controller example. It identifies `https://github.com/Tencent/Biny` as the project repository and directs users to the documentation Wiki at `http://www.billge.cc`. An English Wiki URL is also listed. These are the documented sources for obtaining setup instructions. Although the repository contains `composer.json`, its contents are not reproduced in the README, so an exact dependency installation command cannot be confirmed.

For an established Biny installation, the FAQ gives a concrete upgrade operation: replace the `lib` directory with the version from a newer release. It describes this for both the PHP 8.x compatibility update and later framework updates. The README does not document cache resets, configuration migrations, deployment permissions, or rollback steps, so replacing the directory should follow a deployment-specific backup and validation procedure.

The first runtime setting that can be stated is the template configuration. Biny's examples use PHP short-tag output, and the README says to enable `short_open_tag` in `php.ini`. The documented syntax relationship is:

php
<?php echo $string;?>

The short form is:

php
<?=$string?>

If an application uses its own templates without short-tag syntax, the README says that `short_open_tag` does not need to be enabled. Biny projects that use its examples should confirm this setting before treating template output as an application failure.

No documented first route, controller, database setup, or bootstrap command appears in the README. A new user must obtain those details from the Wiki or inspect the repository conventions before building a first endpoint.

Biny v2.11.0 extensions and PHP compatibility

The clearest change associated with `v2.11.0` is the `App::bind()` registry. The README's Kafka example registers a factory that constructs a producer and then accesses it through `App::$base`. The project also links to MongoDB integration and JWT or JWE integration documents, which apply the same registry pattern to different dependencies.

This mechanism is useful for services outside the MVC framework. It avoids modifying Biny core when adding Kafka, Elasticsearch, RabbitMQ, S3, MongoDB, or a JWT library. Those services are intended examples, not components documented as bundled by default. The presence of `extends/` in the repository indicates extension-related files, but the README does not map every directory to a specific integration.

PHP compatibility is broader than the current version badge alone suggests. The README recommends PHP 8.1 or later, states that `v2.11.0` addresses PHP 8 compatibility and security issues, and says PHP 7.x compatibility is preserved. For a new deployment, PHP 8.1 is the clearest documented recommendation. For an existing deployment, the stated upgrade operation is replacing `lib`.

That upgrade path remains operationally incomplete in the README. Applications using cached records, generated templates, custom extensions, or service factories should verify compatibility with `CHANGELOG.md` and the Wiki before replacing `lib`. PHP compatibility also does not guarantee that every application dependency supports the selected PHP version.

Performance claims and operational trade-offs

The README states that Biny's own response time is under 1 millisecond by default and that single-machine QPS can exceed 3000. Its FAQ provides more context, naming an Intel Xeon Processor E5506 processor running at 2.13 GHz and describing a typical data-query page with a 50% cache hit rate. It also reports throughput more than twice that of Yii under the same conditions.

These figures come from the project's own documentation. The README does not include the test harness, PHP version, enabled extensions, dataset size, query mix, web server settings, or Yii version needed to reproduce the comparison. They can guide an investigation of Biny's performance characteristics, but they do not predict the response time of a particular application. Database latency, templates, remote services, and cache behavior can dominate production results.

Biny's integrated class loading, data layer, and template wrapper are intended to reduce application setup. The corresponding cost is that its conventions become part of the application's design. A project with strict routing, dependency injection, migration, or deployment requirements may prefer a framework that documents those concerns more extensively.

The security claims also need application-level verification. Developers should confirm that queries use Biny's protected data paths and that custom SQL or raw template output does not bypass escaping. The README identifies the protections, but it does not publish a complete list of protected and bypassable paths.

Biny versus a larger PHP MVC framework

Biny's practical alternative is a larger, more prescriptive PHP MVC framework, or an application assembled from separate routing, persistence, templating, validation, and dependency packages. The difference is primarily how much framework convention an application accepts.

Biny focuses on a compact MVC wrapper with automatic class loading, RESTful routing, data helpers, primary-key caching, events, and framework-level SQL and XSS protections. A larger framework may provide more explicit dependency injection, documented migrations, broader integration catalogs, and more detailed operational procedures. The README does not compare Biny with any specific framework beyond a performance comparison mentioning Yii.

For a small PHP application, Biny may reduce the number of separate components a developer must assemble. For an application with strict dependency versions, complex schema migrations, extensive background processing, or established deployment conventions, the absence of a documented Composer installation command and the Wiki-centered documentation are significant disadvantages. The choice comes down to whether the application values a small built-in surface or a larger collection of documented operational patterns.

Editorial conclusion

Developers who want a small MVC layer, built-in SQL and XSS defenses, and compatibility across PHP 7.x and PHP 8.x may find Biny suitable after checking the external Wiki and application conventions. Projects that require a documented installer, current integration standards, or extensive deployment guidance should wait until the project supplies those details. The first adoption check is the v2.11.0 documentation for routing, database setup, templates, and upgrade behavior.

Frequently asked questions

How do I install Tencent Biny and create a first PHP application?

The README does not provide a complete Composer installation command or a first-controller example. It directs users to `http://www.billge.cc` and the repository at `https://github.com/Tencent/Biny` for setup information.

Does Tencent Biny support PHP 8.1 and PHP 7.x?

The README recommends PHP 8.1 or later for `v2.11.0`, says that release addresses PHP 8 compatibility and several security vulnerabilities, and states that PHP 7.x compatibility is preserved.

How do I add MongoDB, JWT, or Kafka to Tencent Biny?

Since `v2.11.0`, Biny documents the `App::bind()` registry for mounting third-party components without modifying framework core. It links to MongoDB and JWT or JWE guides and gives Kafka as a registration example.

Why does Tencent Biny template output look incorrect?

The README says Biny's built-in examples use PHP short-tag rendering, so `short_open_tag` must be enabled in `php.ini`. Applications that use their own templates without short-tag syntax do not need that setting.

What performance does the Tencent Biny README claim?

The README states that framework response time is under 1 millisecond by default and describes single-machine QPS above 3000 for a typical data-query page with a 50% cache hit rate. It does not provide the complete test setup for independent reproduction.

Official sources

  1. Issues
  2. License: BSD-3-Clause
  3. README
  4. Releases
  5. Tencent/Biny on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/tencent-biny.svg)](https://hysenlabs.com/projects/tencent-biny)

Was this useful?