Download the PHP package roolith/framework without Composer
On this page you can find all versions of the php package roolith/framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package framework
roolith-framework
Roolith PHP micro-framework. Very minimalistic and less overhead.
Architecture
Roolith is a minimal synchronous PHP micro-framework with an MVC shape: one entrypoint (index.php) boots shared services through App\Core\System, routes one HTTP request to one controller action, optionally touches MySQL through a thin model layer, then renders a PHP view or returns data and tears down per-request resources.
Shared services are exposed through small singleton factories (RouterFactory, DatabaseFactory, TemplateEngineFactory) and static facades (Request, Storage, Sanitize, Validator), composed from standalone roolith/* packages plus Carbon and Whoops. The database is optional, and frontend assets are built with Vite (source/ -> assets/).
Interested in the whole picture? Start with Architecture in the docs site. ARCHITECTURE.md is canonical; the docs page mirrors it.
Requirements
- PHP >= 8.2 with
intl,zip,opcache(seeDockerfileandcomposer check-platform-reqs) - Composer
Install
Run with Docker
Then open http://localhost:8080. See DOCKER-README.md for details.
Documentation
- Cache documentation
- Config documentation
- Database documentation
- Event documentation
- Generator documentation
- Migration documentation
- Router documentation
- Template-engine documentation
If you want to use this or need any help, you may reach to
[email protected]Free to use for any purpose. Support: see CHANGELOG.md for releases.
Generator
Define route
Open app/Http/routes.php and define routes as per documentation. Prefer the callable form [WelcomeController::class, 'index']; the string form WelcomeController::class . "@index" still works but is legacy. Lint with php roolith route:list.
Error page
If there is no route defined then by default it will look for 404.php in views/ folder.
Config
All application configuration has been stored in config/config.php for more details read documentation
Constant
Application constants have been defined in constant.php
Frontend workflow
The framework uses Vite for SCSS and JavaScript. Actual scripts from package.json:
For development with hot module replacement set viteDevServer to http://localhost:5173 in config/config.php and run
Browse via http://localhost:8080 for direct PHP or http://localhost:5173 for HMR (the dev server proxies everything except @vite, @id, @fs, node_modules, source, __open-in-editor to PHP on :8080, so sessions plus HMR share one origin; see documentation/docs/frontend-workflow.md for proxy limits).
To rebuild assets on change without the dev server use
Entries are source/js/app.js (Vite input key app) and source/scss/app.scss (input key style). To add SCSS and JS use those two files.
Use
for production build.
It creates minified, content-hashed files in the assets/build folder (for example assets/build/js/app-[hash].js plus assets/build/css/app-[hash].css plus assets/build/.vite/manifest.json; views resolve via viteJs() plus viteCss()). Uploads must live outside the build output, e.g. public/uploads/ (web-accessible fixture survives rebuilds) or storage/ (outside the docroot); npm run build wipes only assets/build.
Model
Model files located in app/Models. One model maps to one table via protected string $table plus $primaryColumn (default id); php roolith migrate creates those tables under database/migrations.
Validated write path (filter plus validate plus transaction):
Migrations plus transactions (via roolith/migration; files in database/migrations as *.migration.php, seeders in database/seeders as *.seeder.php, rows in the shared migrations table):
Controllers
Controller files located in app/Controllers
Views
View files are in views/ and view files are straight forward documentation. Escape every untrusted value at render with escape() or $this->escape(); Request::input() stays raw so O'Reilly keeps its form.
Let's keep it simple!
Print route URL inside template
Request
Request::input() returns raw values (no stripping); validate by type, escape at render with escape(). only() plus except() accept a string or array via _::only plus _::except. JSON bodies parse via php://input; all() returns raw plus _files on POST. Pass ['sanitize' => true] only for narrow slug or email paths.
Full form plus JSON plus files example with validation and error display:
hasFile() checks $_FILES; size plus MIME limits live in App\Core\File (see documentation/docs/file-upload.md).
Middleware, rate limiter, and i18n
Attach middleware per route or group:
Reset the limiter on success:
Translate with fallback (missing key or locale returns null):
Note: Settings::setLang('es') writes a cookie, so the new locale applies on the next request, not the current one.
Cache and events
Cache expensive reads, fire events for side effects (see documentation/docs/cache.md and documentation/docs/events.md):
Validator
String example plus array example (see App\Core\Validator.php:8-31 usage block):
Full example with email plus conditional plus URL plus numeric:
Note: notExists() plus exists() check the database (notExists(User::class)); keep them on fields that truly need uniqueness or existence checks.
Sanitize
Narrow helpers for slug plus email lookups; general input stays raw and is escaped at render with escape().
Array methods
Example:
List of methods -
- except
- chunk
- compact
- concat
- difference
- drop
- dropRight
- dropWhile
- filter
- remove
- findIndex
- indexOf
- join
- last
- first
- reverse
- take
- takeRight
- uniq
- find
- each
- contains
- map
- isMultidimensional
- resetKeys
- order
- orderBy
- orderByString
- random
- add
- flat
- dot
- exists
- get
- has
- pluck
- prepend
- query
- set
Localization
Get message with fallback (missing key returns null, so coalesce):
Set local
Once es lang is set it will look in lang/es/message.php. So when es has been set then below code will output -
Dependencies use caret deliberately (roolith/*: ^2.x, nesbot/carbon: ^2.73) so patches flow; exact pins need a comment. Run composer audit regularly.
Observability and checks
Logs carry a per-request trace ID via App\Core\Logger plus App\Core\Log (bootstrap, router, 404, controller, unhandled).
Cookie
Set cookie
Get cookie
Delete cookie
Session
All versions of framework with dependencies
roolith/config Version ^2.0
roolith/database Version ^2.0
roolith/event Version ^2.0
roolith/generator Version ^2.0
roolith/router Version ^2.1
roolith/template-engine Version ^1.1
nesbot/carbon Version ^2.73
filp/whoops Version ^2.18
psr/log Version ^3.0
php Version >=8.2
roolith/migration Version ^2.0