{"id":50206500,"url":"https://github.com/commonphp/runtime","last_synced_at":"2026-05-26T01:30:46.265Z","repository":{"id":358273815,"uuid":"1239350892","full_name":"commonphp/runtime","owner":"commonphp","description":"A small bootstrapping layer that starts a CommonPHP application: it loads environment settings, resolves root paths, builds the container, configures modules/service providers, runs the selected executive, and handles lifecycle events, logging, and shutdown status.","archived":false,"fork":false,"pushed_at":"2026-05-16T14:20:27.000Z","size":60,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-16T16:41:26.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commonphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-15T02:26:36.000Z","updated_at":"2026-05-16T14:20:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/commonphp/runtime","commit_stats":null,"previous_names":["commonphp/runtime"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/commonphp/runtime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fruntime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fruntime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fruntime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fruntime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonphp","download_url":"https://codeload.github.com/commonphp/runtime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fruntime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33500451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T14:31:05.219Z","status":"ssl_error","status_checked_at":"2026-05-25T14:31:02.878Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-26T01:30:45.645Z","updated_at":"2026-05-26T01:30:46.255Z","avatar_url":"https://github.com/commonphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CommonPHP Runtime\n\n![Latest Stable Version](https://img.shields.io/badge/packagist-placeholder-lightgrey.svg)\n![PHP Version](https://img.shields.io/badge/php-%5E8.5-blue.svg)\n![Tests](https://img.shields.io/badge/tests-placeholder-lightgrey.svg)\n![License](https://img.shields.io/badge/license-MIT-green.svg)\n![Total Downloads](https://img.shields.io/badge/downloads-placeholder-lightgrey.svg)\n\nCommonPHP Runtime is the bootstrap/runtime foundation for CommonPHP applications. It provides the small layer that starts an application, creates the runtime container, runs an executive, emits lifecycle events, and returns or exits with an integer status code.\n\nThe package handles kernel execution, initialization context, dotenv loading, two-phase container creation, modules, service providers, events, drivers, logging access, path resolution, runtime context, and runtime error handling.\n\n## What It Is Not\n\nCommonPHP Runtime is not an HTTP framework, router, ORM, config system, filesystem abstraction, session library, cache library, security system, or advanced logging system. It is the boot ROM, not the whole operating system.\n\nSee [package boundaries](docs/package-boundaries.md) for what belongs here and what belongs in separate CommonPHP packages.\n\n## Features\n\n- Abstract `Kernel` for application boot and execution.\n- `ExecutiveInterface` for web, console, worker, or custom runtime modes.\n- Dotenv loading with `APP_ENV` and `APP_DEBUG` support.\n- PHP-DI bootstrap and execution containers with a layered wrapper.\n- Optional `InitializationContext` for replacing runtime collaborators before boot.\n- Container attributes, compilation, proxy, and definition-cache options through `ContainerOptions`.\n- Container configuration through kernel, module, explicit service providers, and execution configurators.\n- Object-based lifecycle and runtime error events.\n- PSR-3 logger binding with `NullLogger` fallback.\n- Immutable `AppContext` snapshot for services.\n- Root/path resolution through `PathResolverInterface`.\n- Lightweight module registration model.\n- Isolated lazy driver container plus single-driver and driver-pool traits.\n\n## Requirements\n\n- PHP `^8.5`\n- `php-di/php-di:^7.1`\n- `symfony/dotenv:^8.0`\n- `psr/log:^3.0`\n\nNo additional PHP extensions are declared by this package.\n\n## Installation\n\n```bash\ncomposer require comphp/runtime\n```\n\nIf this package has not been published yet, this command represents the intended Packagist install command once published.\n\n## Quick Start\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App;\n\nuse CommonPHP\\Runtime\\Contracts\\ExecutiveInterface;\nuse CommonPHP\\Runtime\\Support\\ExitStatus;\nuse CommonPHP\\Runtime\\Kernel;\n\nfinal class AppKernel extends Kernel\n{\n}\n\nfinal class ConsoleExecutive implements ExecutiveInterface\n{\n    public function execute(): int\n    {\n        echo \"Hello from CommonPHP Runtime\\n\";\n\n        return ExitStatus::SUCCESS;\n    }\n}\n\n$kernel = new AppKernel();\n$kernel\n    -\u003esetRoot(dirname(__DIR__))\n    -\u003esetEnvironment('dev')\n    -\u003esetDebugging(true)\n    -\u003esetExecutive(ConsoleExecutive::class);\n\nexit($kernel-\u003eexecute());\n```\n\nUse `execute()` when you want an exit status back. Use `run()` when the kernel should call `exit()` for you.\n\n## Core Concepts\n\n### Kernel\n\nThe [kernel](docs/kernel.md) is the main runtime object. It loads environment state, resolves paths, creates the PHP-DI container, imports modules, configures service providers, emits events, runs the executive, and handles shutdown.\n\n### Initialization Context\n\n[Initialization context](docs/initialization-context.md) lets advanced callers provide runtime collaborators such as a path resolver, module manager, environment loader, container factory, lifecycle handler, event emitter, logger class, container options, and initial environment state.\n\n### Executives\n\n[Executives](docs/executives.md) are runtime modes. A web executive, console executive, worker executive, or test executive can all implement the same `ExecutiveInterface`.\n\n### Modules\n\n[Modules](docs/modules.md) are lightweight registration objects imported before the container is built.\n\n### Service Providers\n\n[Service providers](docs/service-providers.md) add definitions to the PHP-DI `ContainerBuilder`.\n\n### Lifecycle\n\n[Lifecycle](docs/lifecycle.md) describes startup and shutdown ordering for kernels, executives, modules, service providers, and lifecycle events.\n\n### Events\n\n[Events](docs/events.md) are object-based and subscribed to by class name, with optional priorities.\n\n### Drivers\n\n[Drivers](docs/drivers.md) are subsystem-owned implementation objects created lazily by an isolated driver container.\n\n### Logging\n\n[Logging](docs/logging.md) uses PSR-3. If no logger is configured, the runtime binds `Psr\\Log\\NullLogger`.\n\n### AppContext\n\n[AppContext](docs/app-context.md) is a readonly snapshot of start time, environment, debug flag, and root path.\n\n### Path Resolution\n\n[Path resolution](docs/path-resolution.md) joins root-relative paths. It is not a filesystem abstraction.\n\n### Error Handling\n\n[Error handling](docs/error-handling.md) converts executive failures into runtime error events, logs failures when a logger is available, and returns `ExitStatus::EXCEPTION`.\n\n## Documentation\n\nStart with the [documentation index](docs/index.md).\n\nKey pages:\n\n- [Getting started](docs/getting-started.md)\n- [Architecture](docs/architecture.md)\n- [Package boundaries](docs/package-boundaries.md)\n- [Kernel](docs/kernel.md)\n- [Initialization context](docs/initialization-context.md)\n- [Container](docs/container.md)\n- [Lifecycle](docs/lifecycle.md)\n- [Testing and QA](docs/testing.md)\n\n## Examples\n\nExamples live in [docs/examples](docs/examples/):\n\n- [Basic runtime](docs/examples/basic-runtime.md)\n- [Custom executive](docs/examples/custom-executive.md)\n- [Module service provider](docs/examples/module-service-provider.md)\n- [Events](docs/examples/events.md)\n- [Drivers](docs/examples/drivers.md)\n- [Logging](docs/examples/logging.md)\n- [Error handling](docs/examples/error-handling.md)\n\n## Testing and Code Style\n\nIf dependencies are installed:\n\n```bash\nvendor/bin/phpunit -c phpunit.xml.dist\nvendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff\n```\n\nThe current `composer.json` also includes `test`, `cs:check`, and `lint` scripts. See [testing and QA](docs/testing.md) and [development dependencies](docs/dev-dependencies.md).\n\n## Versioning\n\nCommonPHP Runtime is intended to follow semantic versioning. Public interfaces, method names, and observable lifecycle behavior should be treated as compatibility-sensitive.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Security\n\nSee [SECURITY.md](SECURITY.md).\n\n## License\n\nCommonPHP Runtime is released under the MIT license declared in `composer.json`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fruntime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonphp%2Fruntime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fruntime/lists"}