ZeroPHP

Zero Framework Overview

Zero Framework Overview

Zero is a lightweight, native-PHP micro-framework inspired by Laravel's developer experience. It keeps runtime dependencies to a minimum (no Composer required) while providing ergonomic tooling for routing, HTTP handling, templating, and database access.

Architecture at a glance

  • Entry pointpublic/index.php bootstraps configuration, sessions, helpers, then delegates to the router.
  • RoutingZero\Lib\Router maps URIs to controller actions, runs middleware, and resolves controller dependencies. → router.md
  • Request / ResponseZero\Lib\Http\Request captures query/body/JSON/files; Zero\Lib\Http\Response builds replies; controllers can return any scalar/array/model/Response. → request-response.md
  • ViewsZero\Lib\View renders PHP templates with Blade-inspired directives, layouts, sections, and optional caching. → view.md
  • Database (DBML)Zero\Lib\DB\DBML is the fluent query builder on top of the PDO bridge. → dbml.md
  • ModelsZero\Lib\Model is an active-record layer with relations, scopes, and soft deletes. → models.md
  • MigrationsZero\Lib\DB\Schema + Blueprint for structural changes. → migrations.md
  • AuthenticationZero\Lib\Auth\Auth issues JWT cookies and integrates with the bundled login/register/reset scaffold. → auth.md
  • MailingZero\Lib\Mail\Mailer wraps SMTP delivery with fluent Message composition. → mail.md
  • QueueZero\Lib\Queue\Queue + dispatch() push background jobs through sync or database drivers; worker via php zero queue:work. → queue.md
  • HTTP & SOAP clientsZero\Lib\Http for outbound REST + Http::soap() for SOAP. → support/http.md, support/soap.md
  • StorageZero\Lib\Storage\Storage for file IO across disks (local + S3). → storage.md
  • i18nZero\Lib\I18n\Translator for locale resolution, fallback chains, and YAML/JSON loaders. → i18n.md
  • CLI — the zero script ships generators (make:*), database tools (migrate, db:seed, db:dump), and the scheduler (schedule:run). → cli.md
  • Scheduler / cronroutes/cron.php defines tasks; php zero schedule:run evaluates and dispatches them every minute. → cron.md
  • Rate limiting — global + per-route throttling configured via config/rate_limit.php. → rate-limiting.md
  • Support utilitiesStr, Stringable, Arr, Collection, Number, DateTime. → support/
  • Global helpers — built-in (view, response, redirect, route, auth, session, collect, …) plus user-defined helper classes. → helpers.md

Documentation map

docs/
├── overview.md              ← you are here
├── request-response.md      ← Request/Response API
├── router.md                ← routing, groups, middleware, named routes
├── view.md                  ← templates, directives, layouts
├── models.md                ← active-record + relations + ModelQuery
├── dbml.md                  ← fluent query builder
├── migrations.md            ← Schema + Blueprint + CLI workflow
├── database-connections.md  ← driver config (MySQL, PostgreSQL, SQLite)
├── auth.md                  ← Auth facade, JWT, scaffolded login/register flow
├── mail.md                  ← Mailer + Message API
├── i18n.md                  ← translations, locales, fallbacks
├── storage.md               ← file storage + uploads
├── cli.md                   ← generators + database + serve commands
├── cron.md                  ← scheduler API
├── rate-limiting.md         ← throttling config + middleware
├── date.md                  ← DateTime / Date helpers
├── helpers.md               ← global functions + user-defined helpers
├── support.md               ← directory index for utility classes
├── support/
│   ├── index.md             ← per-class index
│   ├── str.md               ← Str::* (94 methods)
│   ├── stringable.md        ← fluent Stringable
│   ├── arr.md               ← Arr::* (39 methods)
│   ├── collection.md        ← collect()/Collection (95 methods)
│   ├── number.md            ← Number::*
│   ├── http.md              ← Http client + ClientResponse
│   ├── soap.md              ← Http::soap()
│   └── filesystem.md        ← File factories + Storage integration
└── deployment.md            ← Nginx + PHP-FPM, env, cron, log rotation

Common workflows

Deployment

For production configuration (Nginx + PHP-FPM, environment, logging, cron), see deployment.md.