lekoala / kaly
A small modular PSR HTTP framework with convention-based routing and first-class dependency injection
Requires
- php: ^8.3
- ext-fileinfo: *
- ext-mbstring: *
- lekoala/kaly-di: ^0.4
- psr/clock: ^1.0
- psr/container: ^1.1.2|^2.0.2
- psr/http-factory: ^1.1
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/polyfill-php84: ^1.30
Requires (Dev)
- carthage-software/mago: ^1.55
- composer/ca-bundle: ^1.5
- latte/latte: ^3.0
- lekoala/kaly-tpl: ^0.3
- nyholm/psr7: ^1.8
- nyholm/psr7-server: ^1.1
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12
- symfony/translation: ^7.1
- symfony/var-dumper: ^7.1
- twig/twig: ^3.0
Suggests
- ext-intl: Better slug transliteration in Kaly\Util\Str::slug
- bakame/tokei: Local times, durations and circular time intervals
- brick/date-time: First-class local dates, times and date-time value objects
- latte/latte: Recommended template language, through Kaly\View\Adapter\LatteRenderer
- lekoala/kaly-forms: Server-rendered HTML forms with progressive enhancement, through the kaly-forms recipe
- lekoala/kaly-tpl: Lightweight native PHP templates, through Kaly\View\Adapter\KalyTplRenderer
- nesbot/carbon: Rich DateTime-compatible date and time manipulation
- nyholm/psr7: Recommended PSR-7 implementation for your application
- spomky-labs/otphp: TOTP/HOTP second-factor authentication
- symfony/mailer: Email delivery through SMTP, sendmail or supported providers
- symfony/translation: Full featured translations (ICU, loaders), through Kaly\I18n\Adapter\SymfonyTranslator
- twig/twig: Supported template engine, through Kaly\View\Adapter\TwigRenderer
- web-auth/webauthn-lib: WebAuthn/FIDO2 strong authentication and passkeys
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-16 14:46:57 UTC
README
Kaly PHP framework
A small modular PSR HTTP framework with convention-based routing and first-class dependency injection
Kaly is an opinionated but lightweight application framework built on PHP standards:
- PSR based: PSR-7 messages, PSR-11 container, PSR-15 middleware.
- Dependency injection: powered by kaly-di, autowiring and explicit definitions.
- Hierarchical routing: every url belongs to one module, which resolves it with conventions (controllers map to URIs), its own route table or a custom resolver — all declared in its
config.php. - Modular architecture: each module has its own config, controllers, templates and assets.
- Middleware support: plain PSR-15 middleware, applied in bands (incoming, routed, outgoing).
- Multilingual support: built-in locale detection.
- Renderer agnostic: Latte (recommended), kaly-tpl (lightweight native PHP) or Twig, through tiny adapters.
- No database, no ORM, no forms: Kaly stays a small HTTP framework.
- Auth and browser security bundled: request identity with permissions, session login, CSRF, CSP nonces and method override (see docs/auth.md and docs/security.md).
- Rate limiting: compose a PSR-15 middleware with a shared limiter; Symfony RateLimiter is recommended (see the rate limiting recipe).
- No HTTP client bundled: outgoing calls go through any PSR-18 client, such as Buzz or Symfony HttpClient (see the HTTP client recipe).
Stability
Kaly is 0.x: breaking changes are made deliberately, in favor of a smaller
and sharper public API rather than piled up behind aliases and deprecation
layers. Read UPGRADE.md before upgrading: it lists every removal
and rename, with the migration.
Internal lekoala/kaly-di and lekoala/kaly-tpl are 0.x too and may evolve
independently.
UPGRADE.md is the record of what changed and why. There is no promise of
backward compatibility within 0.x.
Views
Kaly ships no template engine: return a Kaly\View\View from a controller and register a
Kaly\View\RendererInterface (see docs/views.md). Optional adapters are
provided for Latte, kaly-tpl and Twig.
Requirements
- PHP 8.3+
- A PSR-7 implementation for your application (Nyholm is recommended); the core only depends on the PSR interfaces.
Installation
composer require lekoala/kaly nyholm/psr7
Agent skill for applications
Kaly ships the kaly skill and its five references in
vendor/lekoala/kaly/skills/kaly/. It guides agents working on applications
that consume Kaly. The bundle is included in Composer packages; installation
does not change the application's agent configuration.
For Codex, copy the entire folder into the application's .agents/skills/
directory, a supported local skill location.
Run from the application root on macOS/Linux:
mkdir -p .agents/skills cp -R vendor/lekoala/kaly/skills/kaly .agents/skills/
Or in PowerShell:
New-Item -ItemType Directory -Force .agents/skills | Out-Null Copy-Item -Recurse vendor/lekoala/kaly/skills/kaly .agents/skills/
Invoke it explicitly with $kaly, or let Codex select it for relevant tasks.
For other agents, expose the same folder using their skill installation mechanism.
Refresh the copied bundle after upgrading Kaly, including its references/ folder.
Quick start
// public/index.php require __DIR__ . '/../vendor/autoload.php'; Kaly\Core\App::create(dirname(__DIR__))->run();
// modules/app/config.php -> the module exists because of this file, // and it owns the root because it mounts '/' use Kaly\Core\Module; return static function (Module $module): void { $module->mount('/'); };
// modules/app/src/Controller/IndexController.php -> GET / namespace App\Controller; final class IndexController { public function index(): string { return 'Hello'; } }
A module is any folder of modules/ with a config.php (it may be empty):
without it the folder is invisible and its urls 404. Any other
module is routable under its name (modules/Shop answers on /shop/...).
See UPGRADE.md when updating.
Documentation
- Online: https://lekoala.github.io/kaly/
- Raw Markdown in
docs/stays readable directly on GitHub - Local preview:
composer docs(requires Ruby + Bundler, serves the Jekyll site with live reload)
Testing
composer test