New PHP Framework Leaf: Quick Start and Minimal Code

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

New PHP Framework — Leaf: Lightweight, Fast, and Modern Architecture



In the world of PHP development, another trend is brewing: the Leaf PHP framework is entering the scene. Over the past six months, its popularity has surged — the GitHub repository has already gathered over 8,000 stars, and the community is actively expanding. What makes Leaf attractive to developers accustomed to Laravel or Symfony?



Microkernel and Modularity

The main feature of Leaf is its modular architecture based on a microkernel. Unlike monolithic solutions, Leaf comes with minimal core functionality, and all additional features are added via packages. This allows you to:

  • create projects of any complexity — from a simple API to a full-fledged MVC application;
  • keep the size of the final application minimal;
  • speed up loading times and reduce memory consumption.


Built-in ORM and Database Work

Leaf comes with its own ORM — Leaf Database, which supports MySQL, PostgreSQL, SQLite, and even MongoDB via adapters. At the same time, the syntax is extremely simple:

  • no complex configurations — just pass an array with connection parameters;
  • supports migrations, seeders, and model hydration;
  • built-in protection against SQL injections through prepared queries.


PSR-7 and PSR-15 Support

Leaf fully complies with PHP-FIG standards (PSR-7, PSR-15, PSR-11). This means you can easily integrate any middleware written for other frameworks, or use familiar components (e.g., Guzzle for HTTP requests).



Ready-made Solutions for API

One of Leaf's strong points is its built-in REST API support. You don't need to additionally install Sanctum or Passport: Leaf already includes:

  • automatic route generation;
  • incoming data validation;
  • response serialization to JSON;
  • basic authentication via JWT tokens.

This makes Leaf an excellent choice for startups, microservices, and rapid prototyping.



Why Leaf Specifically?

Compared to Laravel, Leaf does not impose rigid folder structures and does not require a powerful server. Symfony, in turn, remains the best choice for large enterprise projects, but Leaf wins in development speed and ease of entry for beginners.

Furthermore, Leaf is actively developing: updates are released every 2–3 weeks, and the documentation has been translated into Russian by the community. For the PythonLib educational portal, this is a great reason to pay attention to PHP — because Leaf teaches you to think not "as in a framework," but "as in pure PHP," but with modern tools.



If you are just starting to learn PHP or want to try something new — Leaf will be an ideal candidate. Installation via Composer takes 2 minutes, and the first Hello World — no more than 5 lines of code.

Recommended Libraries