Project: gh.mtex.dev/php-zero
Author: MTEX.dev
This document tracks completed work and planned features. Items are ordered by priority within each milestone. Contributions and issue reports are welcome on GitHub.
-
Config— native.envparser, typed accessors -
Router— regex-based, GET/POST/PUT/DELETE, dynamic{params}, groups -
View— output-buffered engine, layout wrapping, fluentview()helper -
Database— PDO wrapper, MySQL only,select/insert/update/delete, transactions -
ExceptionHandler— debug vs. production pages, shutdown handler -
HttpException— typed HTTP errors with status code -
public/.htaccess— Apache rewrite, security headers -
routes/web.php+routes/api.php— split route files -
/api/statusendpoint — memory, timezone, timestamp -
README.md
-
Database— SQLite driver (DB_DRIVER=sqlite|mysql), driver-aware identifier quoting,tableExists(),scalar(),statement() -
abort(int $code, string $message)— global helper → throwsHttpException -
asset(string $path)— cache-busted URLs, CDN prefix support -
Request— typed wrapper: input, files, headers,bearerToken(),ip(), JSON body,require() -
Session— start/destroy/regenerate, flash messages, CSRF token -
Response— fluent builder,json/html/text/redirect/download, cache helpers -
helpers.php—env(),abort(),redirect(),json(),asset(),view(),csrf_field(),old(),dd(),dump()
- Output escaping family —
e(),attr(),raw(),js() -
partial(string $view, array $data)— sub-view helper -
Validator— pipe-rule engine, 22 rules,validated(), custom messages -
validate()global — auto-flash + redirect on failure -
errors(string $field)view helper -
Logger— PSR-3 levels, named channels, daily-rotated files -
Cache— file-based TTL cache,remember(),once(),flush() -
Str— 20+ utilities:slug, case helpers,truncate,mask,random,uuid,formatBytes -
public/css/app.css— extracted stylesheet, BEM classes -
partials/alert.php— flash message partial with SVG icons -
DemoController+ 9 demo views +/demoroute group
- Middleware interface —
handle(Request $request, callable $next): Response - Router middleware — attach to individual routes or groups:
$router->get('/admin', ...)->middleware('auth') - Built-in middleware —
AuthMiddleware,CsrfMiddleware,RateLimitMiddleware,CorsMiddleware - Global middleware stack — registered in
public/index.php, run on every request - Route middleware aliases —
'auth','guest','throttle:60,1'
-
Authclass —Auth::login($user),Auth::logout(),Auth::user(),Auth::check(),Auth::id() - Password helpers —
password_hash()/password_verify()wrappers withbcryptcost config -
auth()global — shorthand forAuth::user()/Auth::check() - Auth demo — login/logout form,
AuthMiddlewareexample
-
Collectionclass — wraparrayresults withmap(),filter(),first(),pluck(),groupBy(),sortBy(),sum(),chunk() - Database returns
Collection—$db->select(...)returnsCollectioninstead of bare array -
Modelbase class — staticfind(int $id),where(array $conditions),all(),create(array $data),save(),delete()— backed byDatabase - Convention-based table names —
User→users,BlogPost→blog_postsviaStr::snake() - Timestamps — optional
created_at/updated_atauto-management
-
QueryBuilderclass — fluent SQL:DB::table('users')->where('active', 1)->orderBy('name')->limit(10)->get() - Supported clauses —
select,where,orWhere,whereIn,join,leftJoin,orderBy,groupBy,having,limit,offset - Aggregates —
count(),sum(),avg(),min(),max() -
DBfacade —DB::table(),DB::raw(),DB::select(),DB::statement()
-
Migrationbase class —up(): void/down(): voidinterface -
migrationstable — tracks applied batch numbers - CLI runner —
php zero migrate,php zero migrate:rollback,php zero migrate:fresh - Schema builder —
Schema::create('users', function (Blueprint $t) { ... }), typed column methods - SQLite + MySQL — schema builder generates correct DDL per driver
-
zeroscript — entry point at project root -
make:controller Name— scaffoldapp/Controllers/NameController.php -
make:migration name— scaffold timestamped migration file -
cache:clear— flushstorage/cache/ -
log:clear— flushstorage/logs/ -
serve— start PHP built-in server onlocalhost:8000 -
env:check— validate required.envkeys are present
-
Eventdispatcher —Event::dispatch('user.registered', $user),Event::on('user.registered', $listener) - Listener classes — implement
handle(array $payload): void - Async-ready — listeners optionally queued (file-based queue backend)
- Built-in events —
request.received,route.matched,exception.handled
-
Httpclass — cURL-based, no Guzzle dependency - Methods —
Http::get(url, query),Http::post(url, body),Http::put(),Http::delete() - Response object —
->json(),->body(),->status(),->header(),->ok(),->throw() - Options — timeout, auth headers,
withToken(),withHeaders(), retry logic
- Template components —
<?= component('button', ['label' => 'Save']) ?>with slot support - View composers — bind data to a view automatically:
View::compose('nav', fn () => ['user' => Auth::user()]) - Stack system —
@push('scripts')/@stack('scripts')for injecting scripts from child views - View caching — optional compiled-view cache for production
- i18n / translation —
t('auth.login'), locale detection, JSON translation files
-
TestCasebase class — bootstraps the framework in an isolated environment - HTTP testing —
$this->get('/users'),$this->post('/login', $data),->assertStatus(200),->assertJson() - Database testing — in-memory SQLite per test, automatic rollback
- Fake helpers —
Cache::fake(),Logger::fake(),Event::fake()
- Error page improvements — request data panel (GET/POST/headers), route match info
-
Config::required(array $keys)— throw on missing keys at boot time -
.env.examplegenerator —php zero env:scaffold - OpenAPI / Swagger stub —
php zero make:openapifrom route definitions - Health endpoint —
/api/healthwith DB ping, cache ping, disk space - Profiling — optional request profiler: SQL count, time per phase, memory delta
These are not yet scheduled but may land in a minor release:
- WebSocket support — via Ratchet or native socket server (separate process)
- Rate limiter —
RateLimit::allow('ip', 60, 60)backed by Cache - Queue / jobs — file-based job queue,
dispatch(new SendEmailJob($user)) - Mail —
Mail::to($user)->send(new WelcomeMail())viamail()or SMTP - Cookie helper —
Cookie::set(),Cookie::get(),Cookie::forget(), signed cookies - Pagination —
$db->paginate('SELECT * FROM posts', page: 2, perPage: 15)→Paginator - File storage —
Storage::put('avatars/user.jpg', $data), local disk + abstracted interface - Signed URLs —
url_signed('/download/report.pdf', expiry: 3600)
PHP-Zero follows Semantic Versioning (MAJOR.MINOR.PATCH):
- PATCH — bug fixes, documentation improvements, no API changes.
- MINOR — new features, backward-compatible. New classes / helpers may be added.
- MAJOR — breaking changes. Deprecated in the prior minor release first.
Minimum PHP version will only advance on a MAJOR release with at least 3 months notice.