Download the PHP package tflori/riki-framework without Composer
On this page you can find all versions of the php package tflori/riki-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tflori/riki-framework
More information about tflori/riki-framework
Files in tflori/riki-framework
Package riki-framework
Short Description A minimalistic framework to connect different libraries within your application.
License MIT
Informations about the package riki-framework
ríki
ríki is a minimalistic framework that focuses on bootstrapping, environment handling and configuration loading. It does not provide controllers, routing, or a fixed application architecture. You bring the structure — ríki keeps the foundation small and explicit.
Install
Recommended project structure
There is no required structure, but the following layout is recommended because it matches how Riki\Environment
resolves paths by default:
Bootstrapping (bootstrap.php)
bootstrap.php is intentionally small:
- it loads Composer autoloading
- it creates an
Environment - it creates your application and returns it
Example:
Environment
The Riki\Environment class represents the install root and the filesystem conventions of your app.
It provides path helpers (config/resources/storage) and lazily loads environment variables from .env files.
Environment variables are loaded automatically on first config load. The environment file is chosen by APP_ENV, which
must be set from the process environment (shell, php-fpm, nginx, systemd, CI, etc.). Process environment always
overrides values from .env.
Example:
This will load .env.production if it exists, otherwise it falls back to .env.
Common usage:
Config
Riki\Config is a small wrapper around nested arrays. It loads your config/*.php files and provides dot-notation
lookups that return sub-config objects when the value is associative.
Configuration is done with PHP files in config/ that return arrays. There are no environment-specific config files;
use .env and APP_ENV for that.
Use the env($key, $default) helper in config files:
Reading config values:
Mutating config values at runtime (useful for tests or overrides):
Application
Riki\Application is your DI container and the central registry for the environment and configuration.
It ensures there is only one live application at a time and exposes static accessors for convenience
(Application::environment(), Application::config(), and any container entry).
Typical usage is to extend it and register dependencies:
Then construct it in bootstrap.php and return it:
Kernel
Riki\Kernel represents a single entrypoint for your application (web, CLI, jobs, etc.).
It is intentionally tiny: pass the application in, and implement handle() with whatever boot logic you need.
Because Application::run() simply calls handle(), you decide when to run bootstrappers, dispatch requests, or
short-circuit early.
Example:
Helper function
The env() helper reads values from the current environment object and can be used inside config files:
Exception
Riki\Exception is a dedicated base exception for the framework. You can catch it to separate framework-level failures
from your own exceptions if you want to handle them differently.
Entrypoint
Entrypoint (for example public/index.php):