runtime/laravel

Laravel 运行时

资助包维护!
nyholm

0.1.1 2021-09-10 20:33 UTC

This package is auto-updated.

Last update: 2024-09-22 13:47:08 UTC


README

Laravel 提供运行时。

如果您是首次接触 Symfony 运行时组件,请阅读 主要说明文件 以获取更多信息。

安装

composer require runtime/laravel

使用

运行时将自动注册。您可以通过为应用程序定义环境变量 APP_RUNTIME 来“强制”运行时。

APP_RUNTIME=Runtime\Laravel\Runtime

前端控制器

// public/index.php

use Illuminate\Contracts\Http\Kernel;

define('LARAVEL_START', microtime(true));

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (): Kernel {
    static $app;

    if (null === $app) {
        $app = require dirname(__DIR__).'/bootstrap/app.php';
    }

    return $app->make(Kernel::class);
};

Artisan

// artisan

use Illuminate\Contracts\Console\Kernel;

define('LARAVEL_START', microtime(true));

require_once __DIR__.'/vendor/autoload_runtime.php';

return function (): Kernel {
    static $app;

    if (null === $app) {
        $app = require __DIR__.'/bootstrap/app.php';
    }

    return $app->make(Kernel::class);
};