Search by

yiisoft / yii-runner

samdarkcebeSilverFirehiqsol

Yii application runner

Package info

github.com/yiisoft/yii-runner

Homepage

Chat

Forum

Wiki

pkg:composer/yiisoft/yii-runner

Fund package maintenance!

Opencollective

yiisoft

Statistics

Installs: 302 981

Dependents: 11

Suggesters: 0

Stars: 17

Open Issues: 4

2.2.1 2025-12-19 12:23 UTC

This package is auto-updated.

Last update: 2026-10-07 16:33:02 UTC


README

Yii

Yii Application Runner


Latest Stable Version Total Downloads Build status Code Coverage Mutation testing badge static analysis type-coverage

The package defines Yii Application Runner. A runner hides application initialization details making configuration process easier.

Requirements

  • PHP 8.0 - 8.5.

Installation

The package could be installed with Composer:

composer require yiisoft/yii-runner

General usage

Install one of the adapters:

Instantiate and run it in an entry script:

use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;

require_once __DIR__ . '/autoload.php';

(new HttpApplicationRunner(
    rootPath: __DIR__, 
    debug: $_ENV['YII_DEBUG'],
    environment: $_ENV['YII_ENV']
))->run();

Configuration

To configure your application, follow the Yii configuration guide. It explains where to put configuration files, register services, and set application parameters.

Choose the configuration environment with the runner's environment constructor argument, as shown in the entry script above. For example, use dev or prod if you have defined those environments in your application. See Yii Config environments for how to define them.

For an HTTP application, configure services in these groups:

  • di-web: define services and their dependencies.
  • di-providers-web: register service providers.
  • di-delegates-web: register additional containers to look up services in.
  • di-tags-web: assign tags to services.

See Yii DI for configuring services, providers, delegates, and tags, and Yii Definitions for supported service definition formats. If your application uses different group names, pass them through the runner's diGroup, diProvidersGroup, diDelegatesGroup, and diTagsGroup constructor arguments. See Yii Config groups for how to map group names to configuration files.

To use an existing configuration instance, assign $runner = $runner->withConfig($config) before calling run(). To use your own PSR-11 container, assign $runner = $runner->withContainer($container) before calling run(). Both methods return a new runner instance, so use the returned value for subsequent calls.

Documentation

If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.

License

The Yii Application Runner is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack