yuf - A Smart, Fast, and Lightweight PHP Framework
yuf (pronounced "[jʌf]" or "[jʊf]") is a smart, fast, and lightweight PHP framework designed with a focus on
simplicity and performance. It has zero external dependencies, other than the actra/autoloader library which is
required for all setups.
Key Features
- Extremely Lightweight: Minimal overhead and fast execution.
- Zero Dependencies: Core framework functions without heavy external libraries.
- Composer Ready: Easy installation via Packagist.
- Standalone Support: Works perfectly without Composer.
- Forced Autoloading: Always uses the specialized
actra/autoloader for maximum performance and control.
- Built-in Security: Includes features like CSP (Content Security Policy) nonce support.
- Authentication Helpers: Supports access rights, password login handling, and optional per-user IP whitelists.
Requirements
- PHP 8.5 or higher
- Common PHP extensions:
mbstring, openssl, pdo, intl, bcmath, simplexml, dom, iconv, curl, libxml,
ctype
Installation
Install yuf and actra/autoloader via Composer or download them manually. Note that yuf always requires
actra/autoloader to be manually initialized.
Via Composer (Recommended)
composer require actra/yuf
Manual Installation
Quick Start
- Create a
.env.php file based on .env.example.php.
- Create an
index.php in your document root based on index.example.php.
- Initialize the Framework Core and provide the path to
Autoloader.php if not using the default.
REST/API Endpoints
yuf includes lightweight helpers for building REST-style endpoints without adding external dependencies.
Useful backend/API features include:
HttpRequest::getRequestMethod() returns a typed RequestMethodEnum.
BaseView::getJsonRequestBody() reads and validates JSON request bodies.
JsonRequestBody provides typed accessors for required and optional string, integer, float, and array values.
BaseView::setSuccessResponseContent() creates standardized success responses.
BaseView::setErrorResponseContent() creates standardized error responses and can set the HTTP status code.
JSON success responses use this structure:
{
"success": true,
"data": {}
}
JSON error responses use this structure:
{
"success": false,
"error": {
"code": 0,
"message": "Error message"
}
}
Optional additional response data is returned in a top-level data property.
Template Tags
yuf templates support custom tags for common rendering logic.
Conditional snippet rendering
The tst:if tag can check whether a snippet file exists in the configured snippets directory by using
compare="hasSnippet".
<tst:if compare="hasSnippet" operator="eq" against="example.html">
<tst:snippet name="example.html"/>
</tst:if>
The value of against is resolved relative to Core::get()->snippetsDirectory.
Documentation
For more detailed examples, please refer to:
.env.example.php: Configuration examples.
index.example.php: Full usage example with manual autoloader initialization.
- UPGRADE.md: Guide for developers updating to or working with new versions.
License
This project is licensed under the MIT License. See the LICENSE file for details.
© 2026 Actra AG