explaingit

laruence/yaf

4,518CAudience · developerComplexity · 3/5Setup · moderate

TLDR

Yaf is a blazing-fast PHP web framework built as a C extension, giving you MVC structure with far less memory and startup cost than pure-PHP frameworks like Laravel or Symfony.

Mindmap

mindmap
  root((Yaf))
    Architecture
      MVC pattern
      Single entry point
      INI config file
    Request Handling
      Controllers
      Action methods
      URL rewriting
    Views and Templates
      PHP templates
      phtml files
      Default view engine
    Extensibility
      Bootstrap files
      Plugin hooks
      Shared library folder
    Installation
      PECL command
      Manual compile
      PHP 7 plus
    Tooling
      Code generator
      Project scaffolding
      php.net docs
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a high-performance PHP web app that handles more traffic without needing bigger servers.

USE CASE 2

Replace a slow pure-PHP framework with a C-powered alternative that keeps the familiar MVC folder structure.

USE CASE 3

Scaffold a new PHP project quickly using the built-in code generator to skip boilerplate setup.

USE CASE 4

Run legacy PHP 5.2 projects on a modern MVC framework using the older Yaf branch.

Tech stack

CPHPPHP ExtensionMVCPECLApacheNginxLighttpd

Getting it running

Difficulty · moderate Time to first run · 30min

Install via PECL with one command, then enable the extension in php.ini. Requires PHP 7.0+. Web server URL rewriting (Apache/Nginx) must be configured to point all requests to public/index.php.

License not mentioned in the explanation.

In plain English

Yaf (Yet Another Framework) is a PHP web framework written in C rather than PHP itself. Instead of loading framework code on every request like a standard PHP library would, Yaf is compiled as a PHP extension and loaded directly into the PHP engine. This makes it significantly faster and lighter on memory than frameworks written in pure PHP. The framework follows the Model-View-Controller (MVC) pattern, which separates application logic (controllers), data handling (models), and HTML output (views) into distinct folders. A typical project has a single public entry point, an index.php file, and all incoming URLs are rewritten to route through it using Apache, Nginx, or Lighttpd rewrite rules. The application configuration lives in an INI file that sets paths and environment-specific settings. Controllers in Yaf extend a base class and expose action methods that handle requests. The default view engine renders PHP-based templates stored as .phtml files. There is also support for bootstrap files (for app initialization), plugins (for hooks into the request lifecycle), and a library folder for shared code. Installation is done through PECL, the PHP extension registry, with a single command. You can also compile it manually from source if needed. The framework requires PHP 7.0 or later on the main branch, with an older branch available for PHP 5.2 projects. Official documentation is hosted on the php.net manual. A code generator tool is included in the repository to scaffold out a starter project automatically, reducing the amount of boilerplate you need to write by hand.

Copy-paste prompts

Prompt 1
I'm using the Yaf PHP framework (a C extension). Help me create a controller with two actions: one that lists items from a model and one that shows a single item, using Yaf's MVC conventions.
Prompt 2
Using Yaf for PHP, write a Bootstrap class that registers a plugin to check if a user is logged in before every request, and redirect to /login if not.
Prompt 3
I have a Yaf project with an INI config file. Show me how to add a new database config section for production vs development environments and read those values inside a controller.
Prompt 4
Help me set up Nginx rewrite rules for a Yaf PHP application so all requests route through the public/index.php entry point.
Prompt 5
Using Yaf's built-in code generator, walk me through scaffolding a new project and explain what each generated folder and file is for in plain English.
Open on GitHub → Explain another repo

← laruence on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.