Overview
Overview of Zero Framework.
Zero Framework is a lightweight, native-PHP micro-framework inspired by Laravel's developer experience. It keeps dependencies to a minimum while providing ergonomic tooling for routing, HTTP handling, templating, and database access.
Architecture at a Glance
- Entry point:
public/index.php
bootstraps configuration, sessions, helpers, and delegates to the router. - Routing:
Zero\Lib\Router
maps request URIs to controller actions, manages middleware, and resolves controller dependencies. - Request lifecycle:
Zero\Lib\Http\Request
captures query, body, JSON, headers, and files into a reusable object for the duration of the request. - Request attributes: Middleware can stash data via
Request::set()
and controllers can read it later withRequest::get()
or property access on the current instance. - Response pipeline: Controllers can return any scalar, array, object, or
Zero\Lib\Http\Response
. The router normalises these viaResponse::resolve()
before sending the payload to the client. - Views:
Zero\Lib\View
renders PHP templates with Blade-inspired directives, layout/section support, and optional caching. - Database access (DBML):
Zero\Lib\DB\DBML
—the Database Management Layer—provides a fluent query builder atop the framework's PDO bridge. - Models:
Zero\Lib\Model
offers an active-record style abstraction that hydrates results into rich PHP objects. - Helpers: The
RegistersHelpers
trait (backed byHelperRegistry
) wires app-specific helper classes into globally callable functions (generate stubs withphp zero make:helper
). - Migrations & Seeders (DBAL): CLI commands (
migrate
,make:migration
,db:seed
) drive the migration DBAL for schema changes and database seeding. - Mailing:
Zero\Lib\Mail\Mailer
wraps SMTP delivery with fluent message composition and dotenv-driven configuration. - HTTP Client:
Zero\Lib\Http\Http
exposes a fluent, cURL-backed client for outbound requests with JSON helpers and timeout configuration. - String Utilities:
Zero\Lib\Support\Str
bundles common string transformations (studly, snake, camel, slug, etc.) for CLI and app code. - Storage:
Zero\Lib\Storage\Storage
writes files to the configured disks; uploaded files call$file->store()
to persist content.
Next Steps
- Explore the request/response lifecycle for details on how input is captured and responses are emitted.
- Review routing to understand grouping, middleware, and parameter binding.
- Dive into DBML for building SQL queries fluently.
- Explore the model layer to work with active-record style objects.
- Review the migrations guide to learn how to shape tables, tweak charset/collation, and modify columns safely.
- Review the CLI tooling for scaffolding, migrations, and seeding workflows.
- Learn how to compose templates in the view layer.
- Review the authentication guide for protecting routes and handling sessions.
- Learn how to send email with the SMTP mailer.
- Browse the CLI reference to discover available tooling.
- Read through the support utilities for the HTTP client and string helper reference.
Deployment
For production configuration, consult docs/deployment for web server examples, environment setup, logging, and post-deploy checklists.