Full Code of laravel/vapor-core for AI

2.0 e03d8fc00766 cached
130 files
473.9 KB
195.8k tokens
518 symbols
1 requests
Download .txt
Showing preview only (510K chars total). Download the full file or copy to clipboard to get everything.
Repository: laravel/vapor-core
Branch: 2.0
Commit: e03d8fc00766
Files: 130
Total size: 473.9 KB

Directory structure:
gitextract__wb9ole1/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── SECURITY.md
│   ├── SUPPORT.md
│   └── workflows/
│       ├── static-analysis.yml
│       ├── tests.yml
│       └── update-changelog.yml
├── .gitignore
├── .styleci.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── composer.json
├── config/
│   └── vapor.php
├── phpstan.neon.dist
├── phpunit.xml.dist
├── src/
│   ├── Arr.php
│   ├── ConfiguresAssets.php
│   ├── ConfiguresDynamoDb.php
│   ├── ConfiguresQueue.php
│   ├── ConfiguresRedis.php
│   ├── ConfiguresSqs.php
│   ├── Console/
│   │   └── Commands/
│   │       ├── OctaneStatusCommand.php
│   │       ├── VaporHealthCheckCommand.php
│   │       ├── VaporQueueListFailedCommand.php
│   │       ├── VaporScheduleCommand.php
│   │       ├── VaporWorkCommand.php
│   │       └── WritesQueueEventMessages.php
│   ├── Contracts/
│   │   ├── LambdaEventHandler.php
│   │   ├── LambdaResponse.php
│   │   └── SignedStorageUrlController.php
│   ├── DefinesRoutes.php
│   ├── Events/
│   │   └── LambdaEvent.php
│   ├── HasAwsContext.php
│   ├── Http/
│   │   ├── Controllers/
│   │   │   └── SignedStorageUrlController.php
│   │   └── Middleware/
│   │       └── ServeStaticAssets.php
│   ├── Logging/
│   │   └── JsonFormatter.php
│   ├── Queue/
│   │   ├── JobAttempts.php
│   │   ├── VaporConnector.php
│   │   ├── VaporJob.php
│   │   ├── VaporQueue.php
│   │   └── VaporWorker.php
│   ├── Runtime/
│   │   ├── ArrayLambdaResponse.php
│   │   ├── CliHandlerFactory.php
│   │   ├── Environment.php
│   │   ├── Fpm/
│   │   │   ├── ActsAsFastCgiDataProvider.php
│   │   │   ├── Fpm.php
│   │   │   ├── FpmApplication.php
│   │   │   ├── FpmHttpHandlerFactory.php
│   │   │   ├── FpmRequest.php
│   │   │   ├── FpmResponse.php
│   │   │   └── FpmResponseHeaders.php
│   │   ├── Handlers/
│   │   │   ├── CliHandler.php
│   │   │   ├── FpmHandler.php
│   │   │   ├── LoadBalancedFpmHandler.php
│   │   │   ├── LoadBalancedOctaneHandler.php
│   │   │   ├── OctaneHandler.php
│   │   │   ├── PayloadFormatVersion2FpmHandler.php
│   │   │   ├── PayloadFormatVersion2OctaneHandler.php
│   │   │   ├── QueueHandler.php
│   │   │   ├── UnknownEventHandler.php
│   │   │   ├── WarmerHandler.php
│   │   │   └── WarmerPingHandler.php
│   │   ├── Http/
│   │   │   └── Middleware/
│   │   │       ├── EnsureBinaryEncoding.php
│   │   │       ├── EnsureOnNakedDomain.php
│   │   │       ├── EnsureVanityUrlIsNotIndexed.php
│   │   │       └── RedirectStaticAssets.php
│   │   ├── HttpKernel.php
│   │   ├── LambdaContainer.php
│   │   ├── LambdaInvocation.php
│   │   ├── LambdaResponse.php
│   │   ├── LambdaRuntime.php
│   │   ├── LoadBalancedLambdaResponse.php
│   │   ├── Logger.php
│   │   ├── NotifiesLambda.php
│   │   ├── Octane/
│   │   │   ├── Octane.php
│   │   │   ├── OctaneHttpHandlerFactory.php
│   │   │   └── OctaneRequestContextFactory.php
│   │   ├── PayloadFormatVersion2LambdaResponse.php
│   │   ├── Request.php
│   │   ├── Response.php
│   │   ├── Secrets.php
│   │   └── StorageDirectories.php
│   ├── Vapor.php
│   ├── VaporJobTimedOutException.php
│   ├── VaporServiceProvider.php
│   └── debug.php
├── stubs/
│   ├── 503.html
│   ├── cliRuntime.php
│   ├── fpmRuntime.php
│   ├── httpHandler.php
│   ├── httpRuntime.php
│   ├── octaneRuntime.php
│   ├── php-fpm.conf
│   ├── rds-combined-ca-bundle.pem
│   ├── runtime-with-vendor-download.php
│   └── runtime.php
└── tests/
    ├── Feature/
    │   ├── ApiGatewayOctaneHandlerTest.php
    │   ├── Commands/
    │   │   └── OctaneStatusCommandTest.php
    │   ├── EnsureOnNakedDomainTest.php
    │   ├── LambdaProxyOctaneHandlerTest.php
    │   ├── LoadBalancedOctaneHandlerTest.php
    │   ├── OctaneManageDatabaseSessionsTest.php
    │   ├── OctaneTest.php
    │   ├── RedirectStaticAssetsTest.php
    │   ├── SignedStorageUrlEndpointTest.php
    │   ├── VaporJobTest.php
    │   └── VaporQueueTest.php
    ├── Fixtures/
    │   ├── 503.json
    │   ├── asset.js
    │   ├── customLambdaEventFromSQS.json
    │   ├── customNonSQSLambdaEvent.json
    │   └── jobLambdaEventFromSQS.json
    ├── TestCase.php
    └── Unit/
        ├── FakeJob.php
        ├── FpmRequestTest.php
        ├── HttpKernelTest.php
        ├── LambdaEventTest.php
        ├── LoadBalancedLambdaResponseTest.php
        ├── Logging/
        │   └── JsonFormatterTest.php
        ├── OctaneHttpHandlerFactoryTest.php
        ├── QueueHandlerTest.php
        ├── Runtime/
        │   └── CliHandlerFactoryTest.php
        ├── VaporConnectorTest.php
        ├── VaporScheduleCommandTest.php
        ├── VaporTest.php
        └── VaporWorkCommandTest.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2


================================================
FILE: .gitattributes
================================================
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.env.example       export-ignore
/.gitattributes     export-ignore
/.gitignore         export-ignore
/.github            export-ignore
/phpunit.xml.dist   export-ignore
/.scrutinizer.yml   export-ignore
/tests              export-ignore
/.editorconfig      export-ignore
phpstan.neon.dist   export-ignore


================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
# Code of Conduct

The Laravel Code of Conduct can be found in the [Laravel documentation](https://laravel.com/docs/contributions#code-of-conduct).


================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contribution Guide

The Laravel contributing guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!--
Please only send a pull request to branches which are currently supported: https://laravel.com/docs/releases#support-policy 

If you are unsure which branch your pull request should be sent to, please read: https://laravel.com/docs/contributions#which-branch

Pull requests without a descriptive title, thorough description, or tests will be closed.

In addition, please describe the benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.
-->


================================================
FILE: .github/SECURITY.md
================================================
# Security Policy

**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**

## Supported Versions

Only the latest major version receives security fixes.

## Reporting a Vulnerability

If you discover a security vulnerability within Laravel, please send an email to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.

### Public PGP Key

```
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: OpenPGP v2.0.8
Comment: Report Security Vulnerabilities to taylor@laravel.com

xsFNBFugFSQBEACxEKhIY9IoJzcouVTIYKJfWFGvwFgbRjQWBiH3QdHId5vCrbWo
s2l+4Rv03gMG+yHLJ3rWElnNdRaNdQv59+lShrZF7Bvu7Zvc0mMNmFOM/mQ/K2Lt
OK/8bh6iwNNbEuyOhNQlarEy/w8hF8Yf55hBeu/rajGtcyURJDloQ/vNzcx4RWGK
G3CLr8ka7zPYIjIFUvHLt27mcYFF9F4/G7b4HKpn75ICKC4vPoQSaYNAHlHQBLFb
Jg/WPl93SySHLugU5F58sICs+fBZadXYQG5dWmbaF5OWB1K2XgRs45BQaBzf/8oS
qq0scN8wVhAdBeYlVFf0ImDOxGlZ2suLK1BKJboR6zCIkBAwufKss4NV1R9KSUMv
YGn3mq13PGme0QoIkvQkua5VjTwWfQx7wFDxZ3VQSsjIlbVyRL/Ac/hq71eAmiIR
t6ZMNMPFpuSwBfYimrXqqb4EOffrfsTzRenG1Cxm4jNZRzX/6P4an7F/euoqXeXZ
h37TiC7df+eHKcBI4mL+qOW4ibBqg8WwWPJ+jvuhANyQpRVzf3NNEOwJYCNbQPM/
PbqYvMruAH+gg7uyu9u0jX3o/yLSxJMV7kF4x/SCDuBKIxSSUI4cgbjIlnxWLXZC
wl7KW4xAKkerO3wgIPnxNfxQoiYiEKA1c3PShWRA0wHIMt3rVRJxwGM4CwARAQAB
zRJ0YXlsb3JAbGFyYXZlbC5jb23CwXAEEwEKABoFAlugFSQCGy8DCwkHAxUKCAIe
AQIXgAIZAQAKCRDKAI7r/Ml7Zo0SD/9zwu9K87rbqXbvZ3TVu7TnN+z7mPvVBzl+
SFEK360TYq8a4GosghZuGm4aNEyZ90CeUjPQwc5fHwa26tIwqgLRppsG21B/mZwu
0m8c5RaBFRFX/mCTEjlpvBkOwMJZ8f05nNdaktq6W98DbMN03neUwnpWlNSLeoNI
u4KYZmJopNFLEax5WGaaDpmqD1J+WDr/aPHx39MUAg2ZVuC3Gj/IjYZbD1nCh0xD
a09uDODje8a9uG33cKRBcKKPRLZjWEt5SWReLx0vsTuqJSWhCybHRBl9BQTc/JJR
gJu5V4X3f1IYMTNRm9GggxcXrlOAiDCjE2J8ZTUt0cSxedQFnNyGfKxe/l94oTFP
wwFHbdKhsSDZ1OyxPNIY5OHlMfMvvJaNbOw0xPPAEutPwr1aqX9sbgPeeiJwAdyw
mPw2x/wNQvKJITRv6atw56TtLxSevQIZGPHCYTSlsIoi9jqh9/6vfq2ruMDYItCq
+8uzei6TyH6w+fUpp/uFmcwZdrDwgNVqW+Ptu+pD2WmthqESF8UEQVoOv7OPgA5E
ofOMaeH2ND74r2UgcXjPxZuUp1RkhHE2jJeiuLtbvOgrWwv3KOaatyEbVl+zHA1e
1RHdJRJRPK+S7YThxxduqfOBX7E03arbbhHdS1HKhPwMc2e0hNnQDoNxQcv0GQp4
2Y6UyCRaus7ATQRboBUkAQgA0h5j3EO2HNvp8YuT1t/VF00uUwbQaz2LIoZogqgC
14Eb77diuIPM9MnuG7bEOnNtPVMFXxI5UYBIlzhLMxf7pfbrsoR4lq7Ld+7KMzdm
eREqJRgUNfjZhtRZ9Z+jiFPr8AGpYxwmJk4v387uQGh1GC9JCc3CCLJoI62I9t/1
K2b25KiOzW/FVZ/vYFj1WbISRd5GqS8SEFh4ifU79LUlJ/nEsFv4JxAXN9RqjU0e
H4S/m1Nb24UCtYAv1JKymcf5O0G7kOzvI0w06uKxk0hNwspjDcOebD8Vv9IdYtGl
0bn7PpBlVO1Az3s8s6Xoyyw+9Us+VLNtVka3fcrdaV/n0wARAQABwsKEBBgBCgAP
BQJboBUkBQkPCZwAAhsuASkJEMoAjuv8yXtmwF0gBBkBCgAGBQJboBUkAAoJEA1I
8aTLtYHmjpIH/A1ZKwTGetHFokJxsd2omvbqv+VtpAjnUbvZEi5g3yZXn+dHJV+K
UR/DNlfGxLWEcY6datJ3ziNzzD5u8zcPp2CqeTlCxOky8F74FjEL9tN/EqUbvvmR
td2LXsSFjHnLJRK5lYfZ3rnjKA5AjqC9MttILBovY2rI7lyVt67kbS3hMHi8AZl8
EgihnHRJxGZjEUxyTxcB13nhfjAvxQq58LOj5754Rpe9ePSKbT8DNMjHbGpLrESz
cmyn0VzDMLfxg8AA9uQFMwdlKqve7yRZXzeqvy08AatUpJaL7DsS4LKOItwvBub6
tHbCE3mqrUw5lSNyUahO3vOcMAHnF7fd4W++eA//WIQKnPX5t3CwCedKn8Qkb3Ow
oj8xUNl2T6kEtQJnO85lKBFXaMOUykopu6uB9EEXEr0ShdunOKX/UdDbkv46F2AB
7TtltDSLB6s/QeHExSb8Jo3qra86JkDUutWdJxV7DYFUttBga8I0GqdPu4yRRoc/
0irVXsdDY9q7jz6l7fw8mSeJR96C0Puhk70t4M1Vg/tu/ONRarXQW7fJ8kl21PcD
UKNWWa242gji/+GLRI8AIpGMsBiX7pHhqmMMth3u7+ne5BZGGJz0uX+CzWboOHyq
kWgfY4a62t3hM0vwnUkl/D7VgSGy4LiKQrapd3LvU2uuEfFsMu3CDicZBRXPqoXj
PBjkkPKhwUTNlwEQrGF3QsZhNe0M9ptM2fC34qtxZtMIMB2NLvE4S621rmQ05oQv
sT0B9WgUL3GYRKdx700+ojHEuwZ79bcLgo1dezvkfPtu/++2CXtieFthDlWHy8x5
XJJjI1pDfGO+BgX0rS3QrQEYlF/uPQynKwxe6cGI62eZ0ug0hNrPvKEcfMLVqBQv
w4VH6iGp9yNKMUOgAECLCs4YCxK+Eka9Prq/Gh4wuqjWiX8m66z8YvKf27sFL3fR
OwGaz3LsnRSxbk/8oSiZuOVLfn44XRcxsHebteZat23lwD93oq54rtKnlJgmZHJY
4vMgk1jpS4laGnvhZj7OwE0EW6AVJAEIAKJSrUvXRyK3XQnLp3Kfj82uj0St8Dt2
h8BMeVbrAbg38wCN8XQZzVR9+bRZRR+aCzpKSqwhEQVtH7gdKgfdNdGNhG2DFAVk
SihMhQz190FKttUZgwY00enzD7uaaA5VwNAZzRIr8skwiASB7UoO+lIhrAYgcQCA
LpwCSMrUNB3gY1IVa2xi9FljEbS2uMABfOsTfl7z4L4T4DRv/ovDf+ihyZOXsXiH
RVoUTIpN8ZILCZiiKubE1sMj4fSQwCs06UyDy17HbOG5/dO9awR/LHW53O3nZCxE
JbCqr5iHa2MdHMC12+luxWJKD9DbVB01LiiPZCTkuKUDswCyi7otpVEAEQEAAcLC
hAQYAQoADwUCW6AVJAUJDwmcAAIbLgEpCRDKAI7r/Ml7ZsBdIAQZAQoABgUCW6AV
JAAKCRDxrCjKN7eORjt2B/9EnKVJ9lwB1JwXcQp6bZgJ21r6ghyXBssv24N9UF+v
5QDz/tuSkTsKK1UoBrBDEinF/xTP2z+xXIeyP4c3mthMHsYdMl7AaGpcCwVJiL62
fZvd+AiYNX3C+Bepwnwoziyhx4uPaqoezSEMD8G2WQftt6Gqttmm0Di5RVysCECF
EyhkHwvCcbpXb5Qq+4XFzCUyaIZuGpe+oeO7U8B1CzOC16hEUu0Uhbk09Xt6dSbS
ZERoxFjrGU+6bk424MkZkKvNS8FdTN2s3kQuHoNmhbMY+fRzKX5JNrcQ4dQQufiB
zFcc2Ba0JVU0nYAMftTeT5ALakhwSqr3AcdD2avJZp3EYfYP/3smPGTeg1cDJV3E
WIlCtSlhbwviUjvWEWJUE+n9MjhoUNU0TJtHIliUYUajKMG/At5wJZTXJaKVUx32
UCWr4ioKfSzlbp1ngBuFlvU7LgZRcKbBZWvKj/KRYpxpfvPyPElmegCjAk6oiZYV
LOV+jFfnMkk9PnR91ZZfTNx/bK+BwjOnO+g7oE8V2g2bA90vHdeSUHR52SnaVN/b
9ytt07R0f+YtyKojuPmlNsbyAaUYUtJ1o+XNCwdVxzarYEuUabhAfDiVTu9n8wTr
YVvnriSFOjNvOY9wdLAa56n7/qM8bzuGpoBS5SilXgJvITvQfWPvg7I9C3QhwK1S
F6B1uquQGbBSze2wlnMbKXmhyGLlv9XpOqpkkejQo3o58B+Sqj4B8DuYixSjoknr
pRbj8gqgqBKlcpf1wD5X9qCrl9vq19asVOHaKhiFZGxZIVbBpBOdvAKaMj4p/uln
yklN3YFIfgmGPYbL0elvXVn7XfvwSV1mCQV5LtMbLHsFf0VsA16UsG8A/tLWtwgt
0antzftRHXb+DI4qr+qEYKFkv9F3oCOXyH4QBhPA42EzKqhMXByEkEK9bu6skioL
mHhDQ7yHjTWcxstqQjkUQ0T/IF9ls+Sm5u7rVXEifpyI7MCb+76kSCDawesvInKt
WBGOG/qJGDlNiqBYYt2xNqzHCJoC
=zXOv
-----END PGP PUBLIC KEY BLOCK-----
```


================================================
FILE: .github/SUPPORT.md
================================================
# Support Questions

The Laravel support guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions#support-questions).


================================================
FILE: .github/workflows/static-analysis.yml
================================================
name: static analysis

on:
  push:
    branches:
      - master
      - '*.x'
  pull_request:

permissions:
  contents: read

jobs:
  tests:
    uses: laravel/.github/.github/workflows/static-analysis.yml@main


================================================
FILE: .github/workflows/tests.yml
================================================
name: tests

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  tests:
    runs-on: ubuntu-22.04

    strategy:
      fail-fast: true
      matrix:
        php: [8.1, 8.2, 8.3]
        laravel: [10, 11, '12', '13']
        exclude:
          - php: 8.1
            laravel: 11
          - laravel: '12'
            php: 8.1
          - laravel: '13'
            php: 8.1
          - laravel: '13'
            php: 8.2

    name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          tools: composer:v2
          coverage: none

      - name: Setup Problem Matches
        run: |
          echo "::add-matcher::${{ runner.tool_cache }}/php.json"
          echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

      - name: Install PHP dependencies
        run: |
          composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update
          composer update --prefer-dist --no-interaction --no-progress

      - name: Install Octane
        run: |
          composer require laravel/octane --with-all-dependencies --dev
        if: |
          matrix.php >= 8.0 && (matrix.laravel == '8' || matrix.laravel == '9' || matrix.laravel == '10' || matrix.laravel == '11')

      - name: Execute unit tests
        run: vendor/bin/phpunit


================================================
FILE: .github/workflows/update-changelog.yml
================================================
name: update changelog

on:
  release:
    types: [released]

jobs:
  update:
    permissions:
      contents: write
    uses: laravel/.github/.github/workflows/update-changelog.yml@main


================================================
FILE: .gitignore
================================================
.env
.phpunit.result.cache
phpunit.xml
build
composer.lock
docs
vendor
coverage


================================================
FILE: .styleci.yml
================================================
preset: laravel

disabled:
  - single_class_element_per_statement


================================================
FILE: CHANGELOG.md
================================================
# Release Notes

## [Unreleased](https://github.com/laravel/vapor-core/compare/v2.43.3...2.0)

## [v2.43.3](https://github.com/laravel/vapor-core/compare/v2.43.2...v2.43.3) - 2026-03-09

* [2.0] Catch PDOException when MySQL server has gone away during SET SESSION wait_timeout reset by [@rizalpahlevii](https://github.com/rizalpahlevii) in https://github.com/laravel/vapor-core/pull/200

## [v2.43.2](https://github.com/laravel/vapor-core/compare/v2.43.1...v2.43.2) - 2026-02-21

* Laravel 13.x Compatibility by [@laravel-shift](https://github.com/laravel-shift) in https://github.com/laravel/vapor-core/pull/199

## [v2.43.1](https://github.com/laravel/vapor-core/compare/v2.43.0...v2.43.1) - 2026-01-20

* fix: `curl_close()` is deprecated by [@mortenhauberg](https://github.com/mortenhauberg) in https://github.com/laravel/vapor-core/pull/198

## [v2.43.0](https://github.com/laravel/vapor-core/compare/v2.42.0...v2.43.0) - 2026-01-08

* Add dynamic cli handler factory. by [@Sfonxs](https://github.com/Sfonxs) in https://github.com/laravel/vapor-core/pull/197

## [v2.42.0](https://github.com/laravel/vapor-core/compare/v2.41.0...v2.42.0) - 2025-12-19

* Expose AWS Lambda execution context for Vapor logging by [@sahil7194](https://github.com/sahil7194) in https://github.com/laravel/vapor-core/pull/196

## [v2.41.0](https://github.com/laravel/vapor-core/compare/v2.40.0...v2.41.0) - 2025-09-10

* fix: Allow custom Lambda events from SQS by [@mathiasgrimm](https://github.com/mathiasgrimm) in https://github.com/laravel/vapor-core/pull/194

## [v2.40.0](https://github.com/laravel/vapor-core/compare/v2.39.0...v2.40.0) - 2025-08-04

## [v2.39.0](https://github.com/laravel/vapor-core/compare/v2.38.2...v2.39.0) - 2025-07-10

* Add API Gateway request timestamp to server variables by [@mortenhauberg](https://github.com/mortenhauberg) in https://github.com/laravel/vapor-core/pull/192

## [v2.38.2](https://github.com/laravel/vapor-core/compare/v2.38.1...v2.38.2) - 2025-07-04

## [v2.38.1](https://github.com/laravel/vapor-core/compare/v2.38.0...v2.38.1) - 2025-06-27

## [v2.38.0](https://github.com/laravel/vapor-core/compare/v2.37.9...v2.38.0) - 2025-06-02

* Fix missing write permission for changelog updater by [@olivernybroe](https://github.com/olivernybroe) in https://github.com/laravel/vapor-core/pull/189
* [2.x] Fixes support for S3-Compatible Storage like Herd minio by [@pintend](https://github.com/pintend) in https://github.com/laravel/vapor-core/pull/190

## [v2.37.9](https://github.com/laravel/vapor-core/compare/v2.37.8...v2.37.9) - 2025-01-07

* Fix parsing multidimensional array from multipart by [@Vinimaks](https://github.com/Vinimaks) in https://github.com/laravel/vapor-core/pull/186

## [v2.37.8](https://github.com/laravel/vapor-core/compare/v2.37.2...v2.37.8) - 2024-12-06

* Fix Octane cookies for v2 by [@Vinimaks](https://github.com/Vinimaks) in https://github.com/laravel/vapor-core/pull/185

## [v2.37.2](https://github.com/laravel/vapor-core/compare/v2.37.1...v2.37.2) - 2024-11-06

* Add missing files in .github by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/vapor-core/pull/178
* [2.x] Reset scoped instances before running a new vapor job by [@themsaid](https://github.com/themsaid) in https://github.com/laravel/vapor-core/pull/183
* Fix tests by [@themsaid](https://github.com/themsaid) in https://github.com/laravel/vapor-core/pull/184

## [v2.37.1](https://github.com/laravel/vapor-core/compare/v2.33.2...v2.37.1) - 2024-03-26

* Use VAPOR_ENV for non-standard environment option by [@joelvh](https://github.com/joelvh) in https://github.com/laravel/vapor-core/pull/176

## [v2.33.2](https://github.com/laravel/cashier/compare/v2.33.1...v2.33.2) - 2023-10-03

* [2.x] Adds helpers to determine when an app is running on Vapor  by @joedixon in https://github.com/laravel/vapor-core/pull/164


================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)

Copyright (c) Taylor Otwell <taylor@laravel.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
# Laravel Vapor Core / Runtime

<p>
<a href="https://github.com/laravel/vapor-core/actions"><img src="https://github.com/laravel/vapor-core/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/vapor-core"><img src="https://img.shields.io/packagist/dt/laravel/vapor-core" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/vapor-core"><img src="https://img.shields.io/packagist/v/laravel/vapor-core" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/vapor-core"><img src="https://img.shields.io/packagist/l/laravel/vapor-core" alt="License"></a>
</p>

[Laravel Vapor](https://vapor.laravel.com) is an auto-scaling, serverless deployment platform for Laravel, powered by AWS Lambda. Manage your Laravel infrastructure on Vapor and fall in love with the scalability and simplicity of serverless.

Vapor abstracts the complexity of managing Laravel applications on AWS Lambda, as well as interfacing those applications with SQS queues, databases, Redis clusters, networks, CloudFront CDN, and more.

This repository contains the core service providers and runtime client used to make Laravel applications run smoothly in a serverless environment. To learn more about Vapor and how to use this repository, please consult the [official documentation](https://docs.vapor.build).


================================================
FILE: composer.json
================================================
{
    "name": "laravel/vapor-core",
    "description": "The kernel and invocation handlers for Laravel Vapor",
    "keywords": [
        "laravel",
        "vapor"
    ],
    "homepage": "https://github.com/laravel/vapor-core",
    "license": "MIT",
    "authors": [
        {
            "name": "Taylor Otwell",
            "email": "taylor@laravel.com"
        }
    ],
    "require": {
        "php": "^7.2|^8.0",
        "aws/aws-sdk-php": "^3.80",
        "guzzlehttp/promises": "^1.4|^2.0",
        "guzzlehttp/guzzle": "^6.3|^7.0",
        "hollodotme/fast-cgi-client": "^3.0",
        "illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
        "illuminate/http": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
        "illuminate/queue": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
        "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
        "monolog/monolog": "^1.12|^2.0|^3.2",
        "nyholm/psr7": "^1.0",
        "riverline/multipart-parser": "^2.0.9",
        "symfony/process": "^4.3|^5.0|^6.0|^7.0",
        "symfony/psr-http-message-bridge": "^1.0|^2.0|^6.4|^7.0"
    },
    "require-dev": {
        "laravel/octane": "*",
        "mockery/mockery": "^1.2",
        "orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
        "phpstan/phpstan": "^1.10|^2.1",
        "phpunit/phpunit": "^8.0|^9.0|^10.4|^11.5.3|^12.5.12"
    },
    "autoload": {
        "psr-4": {
            "Laravel\\Vapor\\": "src"
        },
        "files": [
            "src/debug.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Laravel\\Vapor\\Tests\\": "tests"
        }
    },
    "scripts": {
        "test": "vendor/bin/phpunit"
    },
    "extra": {
        "branch-alias": {
            "dev-master": "2.0-dev"
        },
        "laravel": {
            "providers": [
                "Laravel\\Vapor\\VaporServiceProvider"
            ],
            "aliases": {
                "Vapor": "Laravel\\Vapor\\Vapor"
            }
        }
    },
    "config": {
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}


================================================
FILE: config/vapor.php
================================================
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Redirect "www" To The Root Domain
    |--------------------------------------------------------------------------
    |
    | When this option is enabled, Vapor will redirect requests to the "www"
    | subdomain to the application's root domain. When this option is not
    | enabled, Vapor redirects your root domain to the "www" subdomain.
    |
    */

    'redirect_to_root' => true,

    /*
    |--------------------------------------------------------------------------
    | Redirect robots.txt
    |--------------------------------------------------------------------------
    |
    | When this option is enabled, Vapor will redirect requests for your
    | application's "robots.txt" file to the location of the S3 asset
    | bucket or CloudFront's asset URL instead of serving directly.
    |
    */

    'redirect_robots_txt' => true,

    /*
    |--------------------------------------------------------------------------
    | Servable Assets
    |--------------------------------------------------------------------------
    |
    | Here you can configure list of public assets that should be servable
    | from your application's domain instead of only being servable via
    | the public S3 "asset" bucket or the AWS CloudFront CDN network.
    |
    */

    'serve_assets' => [
        //
    ],

];


================================================
FILE: phpstan.neon.dist
================================================
parameters:
  paths:
    - config
    - src

  level: 0

  ignoreErrors:
    - "#Unsafe usage of new static\\(\\)#"
    - "#\\(void\\) is used.#"


================================================
FILE: phpunit.xml.dist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
         backupGlobals="false"
         backupStaticAttributes="false"
         colors="true"
         verbose="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         convertDeprecationsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
>
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <php>
        <env name="APP_VANITY_URL" value="foo.vapor.build"/>
        <env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
    </php>
</phpunit>


================================================
FILE: src/Arr.php
================================================
<?php

namespace Laravel\Vapor;

/*
The MIT License (MIT)

Copyright (c) 2018 Matthieu Napoli

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/*

/**
 * @author Taylor Otwell <taylor@laravel.com>
 * @author Matthieu Napoli <matthieu@mnapoli.fr>
 */
class Arr
{
    /**
     * Set a multi-part body array value in the given array.
     *
     * @param  array  $array
     * @param  string  $name
     * @param  mixed  $value
     * @return array
     */
    public static function setMultipartArrayValue(array $array, string $name, $value)
    {
        $segments = explode('[', $name);

        $pointer = &$array;

        foreach ($segments as $key => $segment) {
            // If this is our first time through the loop we will just grab the initial
            // key's part of the array. After this we will start digging deeper into
            // the array as needed until we get to the correct depth in the array.
            if ($key === 0) {
                $pointer = &$pointer[$segment];

                continue;
            }

            // If this segment is malformed, we will just use the key as-is since there
            // is nothing we can do with it from here. We will return the array back
            // to the caller with the value set. We cannot continue looping on it.
            if (static::malformedMultipartSegment($segment)) {
                $array[$name] = $value;

                return $array;
            }

            $segment = substr($segment, 0, -1);

            // If the segment is empty after trimming off the closing bracket, it means
            // we are at the end of the segment and are ready to set the value so we
            // can grab a pointer to the array location and set it after the loop.
            if ($segment === '') {
                $pointer = &$pointer[];
            } else {
                $pointer = &$pointer[$segment];
            }
        }

        $pointer = $value;

        return $array;
    }

    /**
     * Determine if the given multi-part value segment is malformed.
     *
     * This can occur when there are two [[ or no closing bracket.
     *
     * @param  string  $segment
     * @return bool
     */
    protected static function malformedMultipartSegment($segment)
    {
        return $segment === '' || substr($segment, -1) !== ']';
    }
}


================================================
FILE: src/ConfiguresAssets.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Support\Facades\Config;

trait ConfiguresAssets
{
    /**
     * Ensure the asset path is properly configured.
     *
     * @return void
     */
    protected function ensureAssetPathsAreConfigured()
    {
        // Ensure we are running on Vapor...
        if (! isset($_ENV['VAPOR_SSM_PATH'])) {
            return;
        }

        if (! Config::get('app.asset_url')) {
            Config::set('app.asset_url', $_ENV['ASSET_URL'] ?? '/');
        }

        if (! Config::get('app.mix_url')) {
            Config::set('app.mix_url', $_ENV['MIX_URL'] ?? '/');
        }
    }
}


================================================
FILE: src/ConfiguresDynamoDb.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Support\Facades\Config;

trait ConfiguresDynamoDb
{
    /**
     * Ensure DynamoDb is properly configured.
     *
     * @return void
     */
    protected function ensureDynamoDbIsConfigured()
    {
        // Ensure we are running on Vapor...
        if (! isset($_ENV['VAPOR_SSM_PATH'])) {
            return;
        }

        Config::set('cache.stores.dynamodb', array_merge([
            'driver' => 'dynamodb',
            'key' => $_ENV['AWS_ACCESS_KEY_ID'] ?? null,
            'secret' => $_ENV['AWS_SECRET_ACCESS_KEY'] ?? null,
            'region' => $_ENV['AWS_DEFAULT_REGION'] ?? 'us-east-1',
            'table' => $_ENV['DYNAMODB_CACHE_TABLE'] ?? 'cache',
            'endpoint' => $_ENV['DYNAMODB_ENDPOINT'] ?? null,
        ], Config::get('cache.stores.dynamodb') ?? []));
    }
}


================================================
FILE: src/ConfiguresQueue.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Cache\NullStore;
use Illuminate\Cache\Repository;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Laravel\Vapor\Queue\JobAttempts;
use Laravel\Vapor\Queue\VaporWorker;

trait ConfiguresQueue
{
    /**
     * Ensure the queue / workers are configured.
     *
     * @return void
     */
    protected function ensureQueueIsConfigured()
    {
        if ($this->app->bound('queue.vaporWorker')) {
            return;
        }

        $this->app->singleton('queue.vaporWorker', function () {
            $isDownForMaintenance = function () {
                return $this->app->isDownForMaintenance();
            };

            return new VaporWorker(
                $this->app['queue'],
                $this->app['events'],
                $this->app[ExceptionHandler::class],
                $isDownForMaintenance
            );
        });

        $this->app->singleton(JobAttempts::class, function () {
            return new JobAttempts(
                isset($_ENV['VAPOR_CACHE_JOB_ATTEMPTS']) && $_ENV['VAPOR_CACHE_JOB_ATTEMPTS'] === 'true'
                    ? $this->app['cache']->driver()
                    : new Repository(new NullStore())
            );
        });
    }
}


================================================
FILE: src/ConfiguresRedis.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;

trait ConfiguresRedis
{
    /**
     * Ensure Redis is properly configured.
     *
     * @return void
     */
    protected function ensureRedisIsConfigured()
    {
        if (! isset($_ENV['VAPOR_CACHE']) || $_ENV['VAPOR_CACHE'] !== 'true') {
            return;
        }

        Config::set('database.redis', array_merge(Arr::except(Config::get('database.redis', []), ['default', 'cache']), [
            'client' => $_ENV['REDIS_CLIENT'] ?? 'phpredis',
            'options' => array_merge(
                Config::get('database.redis.options', []),
                array_filter([
                    'cluster' => $_ENV['REDIS_CLUSTER'] ?? 'redis',
                    'scheme' => $_ENV['REDIS_SCHEME'] ?? null,
                    'context' => array_filter(['cafile' => $_ENV['REDIS_SSL_CA'] ?? null]),
                ])
            ),
            'clusters' => array_merge(Config::get('database.redis.clusters', []), [
                'default' => [
                    [
                        'host' => $_ENV['REDIS_HOST'] ?? '127.0.0.1',
                        'password' => null,
                        'port' => 6379,
                        'database' => 0,
                    ],
                ],
                'cache' => [
                    [
                        'host' => $_ENV['REDIS_HOST'] ?? '127.0.0.1',
                        'password' => null,
                        'port' => 6379,
                        'database' => 0,
                    ],
                ],
            ]),
        ]));
    }
}


================================================
FILE: src/ConfiguresSqs.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Support\Facades\Config;

trait ConfiguresSqs
{
    /**
     * Ensure SQS is properly configured.
     *
     * @return void
     */
    protected function ensureSqsIsConfigured()
    {
        // Ensure we are running on Vapor...
        if (! isset($_ENV['VAPOR_SSM_PATH'])) {
            return;
        }

        Config::set('queue.connections.sqs', array_merge([
            'driver' => 'sqs',
            'key' => $_ENV['AWS_ACCESS_KEY_ID'] ?? null,
            'secret' => $_ENV['AWS_SECRET_ACCESS_KEY'] ?? null,
            'prefix' => $_ENV['SQS_PREFIX'] ?? null,
            'queue' => $_ENV['SQS_QUEUE'] ?? 'default',
            'region' => $_ENV['AWS_DEFAULT_REGION'] ?? 'us-east-1',
        ], Config::get('queue.connections.sqs') ?? []));
    }
}


================================================
FILE: src/Console/Commands/OctaneStatusCommand.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Illuminate\Console\Command;

class OctaneStatusCommand extends Command
{
    /**
     * The command's signature.
     *
     * @var string
     */
    public $signature = 'octane:status';

    /**
     * The command's description.
     *
     * @var string
     */
    public $description = 'Get the current status of the Octane server';

    /**
     * Handle the command.
     *
     * @return void
     */
    public function handle()
    {
        $this->isEnvironmentRunningOnOctane()
            ? $this->info('Octane server is running.')
            : $this->info('Octane server is not running.');
    }

    /**
     * Determine if the environment is running on Octane.
     *
     * @return bool
     */
    protected function isEnvironmentRunningOnOctane()
    {
        return isset($_ENV['OCTANE_DATABASE_SESSION_TTL']);
    }
}


================================================
FILE: src/Console/Commands/VaporHealthCheckCommand.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;

class VaporHealthCheckCommand extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'vapor:health-check';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Check the health of the Vapor application';

    /**
     * Indicates whether the command should be shown in the Artisan command list.
     *
     * @var bool
     */
    protected $hidden = true;

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->ensureBaseConfigurationFilesWereHarmonized();

        $this->ensureCacheIsWorking();

        return $this->info('Health check complete!');
    }

    /**
     * Ensure the configuration files were harmonized.
     *
     * @return void
     */
    protected function ensureBaseConfigurationFilesWereHarmonized()
    {
        if (! file_exists($filename = __DIR__.'/../../../../framework/config/cache.php')) {
            return;
        }

        $configuration = file_get_contents($filename);

        if (! Str::contains($configuration, "'key' => env('NULL_AWS_ACCESS_KEY_ID')")) {
            throw new Exception(
                'Laravel 11 or later requires the latest version of Vapor CLI.'
            );
        }
    }

    /**
     * Ensure cache calls are working as expected.
     *
     * @return void
     */
    protected function ensureCacheIsWorking()
    {
        Cache::get('vapor-health-check');
    }
}


================================================
FILE: src/Console/Commands/VaporQueueListFailedCommand.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Queue\ManuallyFailedException;
use Illuminate\Support\Str;

class VaporQueueListFailedCommand extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'vapor:queue-failed
                            {--limit= : The number of failed jobs to return}
                            {--page=1 : The page of failed jobs to return}
                            {--id= : The job ID filter by}
                            {--queue= : The queue to filter by}
                            {--query= : The search query to filter by}
                            {--start= : The start timestamp to filter by}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'List all of the failed queue jobs';

    /**
     * Indicates whether the command should be shown in the Artisan command list.
     *
     * @var bool
     */
    protected $hidden = true;

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $options = collect($this->options())
            ->filter(function ($value, $option) {
                return ! is_null($value) && in_array($option, ['id', 'queue', 'query', 'start']);
            });

        $failer = $this->laravel['queue.failer'];
        $start = $this->option('start');

        if (is_callable([$failer, 'getTable']) && $start) {
            $failed = $failer->getTable()
                ->where('failed_at', '>=', Carbon::createFromTimestamp($start)->toDateTimeString())
                ->get();

            $options = $options->reject(function ($value, $name) {
                return $name === 'start';
            });
        } else {
            $failed = $failer->all();
        }

        $failedJobs = collect($failed)->filter(function ($job) use ($options) {
            return $options->every(function ($value, $option) use ($job) {
                return $this->filter($job, $option, $value);
            });
        });

        $total = count($failedJobs);

        $page = $this->option('page');
        $limit = $this->option('limit');

        if ($limit) {
            $failedJobs = $failedJobs->forPage($page, $limit);
        }

        $failedJobs = $failedJobs->map(function ($failed) {
            return array_merge((array) $failed, [
                'payload' => $failed->payload,
                'exception' => Str::limit($failed->exception, 1000),
                'name' => $this->extractJobName($failed->payload),
                'queue' => Str::afterLast($failed->queue, '/'),
                'message' => $this->extractMessage($failed->exception),
                'connection' => $failed->connection,
            ]);
        })->values()->toArray();

        $failedJobs = [
            'failed_jobs' => $failedJobs,
            'total' => $total,
            'from' => $limit ? ($page - 1) * $limit + 1 : 1,
            'to' => $limit ? min($page * $limit, $total) : $total,
            'has_next_page' => $limit && $total > $limit * $page,
            'has_previous_page' => $limit && $page > 1 && $total > $limit * ($page - 1),
        ];

        $this->output->writeln(
            json_encode($failedJobs)
        );
    }

    /**
     * Extract the failed job name from payload.
     *
     * @param  string  $payload
     * @return string|null
     */
    private function extractJobName($payload)
    {
        $payload = json_decode($payload, true);

        if ($payload && (! isset($payload['data']['command']))) {
            return $payload['job'] ?? null;
        } elseif ($payload && isset($payload['data']['command'])) {
            return $this->matchJobName($payload);
        }
    }

    /**
     * Extract the failed job message from exception.
     *
     * @param  string  $exception
     * @return string
     */
    private function extractMessage($exception)
    {
        if (Str::startsWith($exception, ManuallyFailedException::class)) {
            $message = 'Manually failed';
        } else {
            [$_, $message] = explode(':', $exception);
            [$message] = explode(' in /', $message);
            [$message] = explode(' in closure', $message);
        }

        if (! empty($message)) {
            return trim($message);
        }

        return '';
    }

    /**
     * Match the job name from the payload.
     *
     * @param  array  $payload
     * @return string|null
     */
    protected function matchJobName($payload)
    {
        preg_match('/"([^"]+)"/', $payload['data']['command'], $matches);

        return $matches[1] ?? $payload['job'] ?? null;
    }

    /**
     * Determine whether the given job matches the given filter.
     *
     * @param  stdClass  $job
     * @param  string  $option
     * @param  string  $value
     * @return bool
     */
    protected function filter($job, $option, $value)
    {
        if ($option === 'id') {
            return $job->id === $value;
        }

        if ($option === 'queue') {
            return Str::afterLast($job->queue, '/') === $value;
        }

        if ($option === 'query') {
            return Str::contains(json_encode($job), $value);
        }

        if ($option === 'start') {
            return Carbon::parse($job->failed_at)->timestamp >= $value;
        }

        return false;
    }
}


================================================
FILE: src/Console/Commands/VaporScheduleCommand.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Support\Str;

class VaporScheduleCommand extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'vapor:schedule';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Run the scheduled commands at the beginning of every minute';

    /**
     * Indicates whether the command should be shown in the Artisan command list.
     *
     * @var bool
     */
    protected $hidden = true;

    /**
     * Execute the console command.
     */
    public function handle(): int
    {
        if (! $cache = $this->ensureValidCacheDriver()) {
            $this->call('schedule:run');

            return 0;
        }

        $key = (string) Str::uuid();
        $lockObtained = false;

        while (true) {
            if (! $lockObtained) {
                $lockObtained = $this->obtainLock($cache, $key);
            }

            if ($lockObtained && now()->second === 0) {
                $this->releaseLock($cache);

                $this->call('schedule:run');

                return 0;
            }

            if (! $lockObtained && now()->second === 0) {
                return 1;
            }

            usleep(10000);
        }
    }

    /**
     * Ensure the cache driver is valid.
     */
    protected function ensureValidCacheDriver(): ?Repository
    {
        $manager = $this->laravel['cache'];

        if (in_array($manager->getDefaultDriver(), ['memcached', 'redis', 'dynamodb', 'database'])) {
            return $manager->driver();
        }

        return null;
    }

    /**
     * Obtain the lock for the schedule.
     */
    protected function obtainLock(Repository $cache, string $key): bool
    {
        return $key === $cache->remember('vapor:schedule:lock', 60, function () use ($key) {
            return $key;
        });
    }

    /**
     * Release the lock for the schedule.
     */
    protected function releaseLock(Repository $cache): void
    {
        $cache->forget('vapor:schedule:lock');
    }
}


================================================
FILE: src/Console/Commands/VaporWorkCommand.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Queue\WorkerOptions;
use Laravel\Vapor\Events\LambdaEvent;
use Laravel\Vapor\Queue\VaporJob;
use Laravel\Vapor\Queue\VaporWorker;

class VaporWorkCommand extends Command
{
    use WritesQueueEventMessages;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $signature = 'vapor:work
                            {--delay=0 : The number of seconds to delay failed jobs}
                            {--timeout=0 : The number of seconds a child process can run}
                            {--tries=0 : Number of times to attempt a job before logging it failed}
                            {--force : Force the worker to run even in maintenance mode}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Process a Vapor job';

    /**
     * Indicates whether the command should be shown in the Artisan command list.
     *
     * @var bool
     */
    protected $hidden = true;

    /**
     * The queue worker instance.
     *
     * @var \Laravel\Vapor\Queue\VaporWorker
     */
    protected $worker;

    /**
     * Indicates if the worker is already listening for events.
     *
     * @var bool
     */
    protected static $listeningForEvents = false;

    /**
     * Create a new queue work command.
     *
     * @param  \Laravel\Vapor\Queue\VaporWorker  $worker
     * @return void
     */
    public function __construct(VaporWorker $worker)
    {
        parent::__construct();

        $this->worker = $worker;
    }

    /**
     * Execute the console command.
     *
     * @param  \Laravel\Vapor\Events\LambdaEvent  $event
     * @return void
     */
    public function handle(LambdaEvent $event)
    {
        if ($this->downForMaintenance()) {
            return;
        }

        if (! static::$listeningForEvents) {
            $this->listenForEvents();

            static::$listeningForEvents = true;
        }

        $this->worker->setCache($this->laravel['cache']->driver());

        return $this->worker->runVaporJob(
            $this->marshalJob($this->message($event)),
            'sqs',
            $this->gatherWorkerOptions()
        );
    }

    /**
     * Marshal the job with the given message ID.
     *
     * @param  array  $message
     * @return \Laravel\Vapor\Queue\VaporJob
     */
    protected function marshalJob(array $message)
    {
        $normalizedMessage = $this->normalizeMessage($message);

        $queue = $this->worker->getManager()->connection('sqs');

        return new VaporJob(
            $this->laravel, $queue->getSqs(), $normalizedMessage,
            'sqs', $this->queueUrl($message)
        );
    }

    /**
     * Normalize the casing of the message array.
     *
     * @param  array  $message
     * @return array
     */
    protected function normalizeMessage(array $message)
    {
        return [
            'MessageId' => $message['messageId'],
            'ReceiptHandle' => $message['receiptHandle'],
            'Body' => $message['body'],
            'Attributes' => $message['attributes'],
            'MessageAttributes' => $message['messageAttributes'],
        ];
    }

    /**
     * Get the message payload.
     *
     * @param  \Laravel\Vapor\Events\LambdaEvent  $event
     * @return array
     */
    protected function message($event)
    {
        return $event['Records'][0];
    }

    /**
     * Get the queue URL from the given message.
     *
     * @param  array  $message
     * @return string
     */
    protected function queueUrl(array $message)
    {
        $eventSourceArn = explode(':', $message['eventSourceARN']);

        return sprintf(
            'https://sqs.%s.amazonaws.com/%s/%s',
            $message['awsRegion'],
            $accountId = $eventSourceArn[4],
            $queue = $eventSourceArn[5]
        );
    }

    /**
     * Gather all of the queue worker options as a single object.
     *
     * @return \Illuminate\Queue\WorkerOptions
     */
    protected function gatherWorkerOptions()
    {
        $options = [
            $this->option('delay'),
            $memory = 512,
            $this->option('timeout'),
            $sleep = 0,
            $this->option('tries'),
            $this->option('force'),
            $stopWhenEmpty = false,
        ];

        if (property_exists(WorkerOptions::class, 'name')) {
            $options = array_merge(['default'], $options);
        }

        return new WorkerOptions(...$options);
    }

    /**
     * Store a failed job event.
     *
     * @param  \Illuminate\Queue\Events\JobFailed  $event
     * @return void
     */
    protected function logFailedJob(JobFailed $event)
    {
        $this->laravel['queue.failer']->log(
            $event->connectionName, $event->job->getQueue(),
            $event->job->getRawBody(), $event->exception
        );
    }

    /**
     * Determine if the worker should run in maintenance mode.
     *
     * @return bool
     */
    protected function downForMaintenance()
    {
        if (! $this->option('force')) {
            return $this->laravel->isDownForMaintenance();
        }

        return false;
    }

    /**
     * Reset static variables.
     *
     * @return void
     */
    public static function flushState()
    {
        static::$listeningForEvents = false;
    }
}


================================================
FILE: src/Console/Commands/WritesQueueEventMessages.php
================================================
<?php

namespace Laravel\Vapor\Console\Commands;

use Illuminate\Contracts\Queue\Job;
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;

trait WritesQueueEventMessages
{
    /**
     * Listen for the queue events in order to update the console output.
     *
     * @return void
     */
    protected function listenForEvents()
    {
        $this->laravel['events']->listen(JobProcessing::class, function ($event) {
            $this->writeOutput($event->job, 'starting');
        });

        $this->laravel['events']->listen(JobProcessed::class, function ($event) {
            $this->writeOutput($event->job, 'success');
        });

        $this->laravel['events']->listen(JobFailed::class, function ($event) {
            $this->writeOutput($event->job, 'failed');

            $this->logFailedJob($event);
        });
    }

    /**
     * Write the status output for the queue worker.
     *
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  string  $status
     * @return void
     */
    protected function writeOutput(Job $job, $status)
    {
        switch ($status) {
            case 'starting':
                return $this->writeStatus($job, 'Processing', 'comment');
            case 'success':
                return $this->writeStatus($job, 'Processed', 'info');
            case 'failed':
                return $this->writeStatus($job, 'Failed', 'error');
        }
    }

    /**
     * Format the status output for the queue worker.
     *
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  string  $status
     * @param  string  $type
     * @return void
     */
    protected function writeStatus(Job $job, $status, $type)
    {
        $this->output->writeln(sprintf(
            "<{$type}>%s</{$type}> %s",
            str_pad("{$status}:", 11), $job->resolveName()
        ));
    }
}


================================================
FILE: src/Contracts/LambdaEventHandler.php
================================================
<?php

namespace Laravel\Vapor\Contracts;

interface LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event);
}


================================================
FILE: src/Contracts/LambdaResponse.php
================================================
<?php

namespace Laravel\Vapor\Contracts;

interface LambdaResponse
{
    /**
     * Convert the response to API Gateway's supported format.
     *
     * @return array
     */
    public function toApiGatewayFormat();
}


================================================
FILE: src/Contracts/SignedStorageUrlController.php
================================================
<?php

namespace Laravel\Vapor\Contracts;

use Illuminate\Http\Request;

interface SignedStorageUrlController
{
    /**
     * Create a new signed URL.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request);
}


================================================
FILE: src/DefinesRoutes.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Support\Facades\Route;

trait DefinesRoutes
{
    /**
     * Ensure that Vapor's internal routes are defined.
     *
     * @return void
     */
    public function ensureRoutesAreDefined()
    {
        if ($this->app->routesAreCached()) {
            return;
        }

        if (config('vapor.signed_storage.enabled', true)) {
            Route::post(
                config('vapor.signed_storage.url', '/vapor/signed-storage-url'),
                Contracts\SignedStorageUrlController::class.'@store'
            )->middleware(config('vapor.middleware', 'web'));
        }
    }
}


================================================
FILE: src/Events/LambdaEvent.php
================================================
<?php

namespace Laravel\Vapor\Events;

use ArrayAccess;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;

class LambdaEvent implements ArrayAccess, Arrayable
{
    /**
     * The underlying event.
     *
     * @var array
     */
    protected $event;

    /**
     * Creates a new event instance.
     *
     * @param  array  $event
     * @return void
     */
    public function __construct($event)
    {
        $this->event = $event;
    }

    /**
     * Determine if an item exists at an offset.
     *
     * @param  string  $key
     * @return bool
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($key)
    {
        return Arr::exists($this->event, $key);
    }

    /**
     * Get an item at a given offset.
     *
     * @param  string  $key
     * @return array|string|int
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($key)
    {
        return Arr::get($this->event, $key);
    }

    /**
     * Set the item at a given offset.
     *
     * @param  string  $key
     * @param  array|string|int  $value
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($key, $value)
    {
        Arr::set($this->event, $key, $value);
    }

    /**
     * Unset the item at a given offset.
     *
     * @param  string  $key
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($key)
    {
        Arr::forget($this->event, $key);
    }

    /**
     * Get the instance as an array.
     *
     * @return array
     */
    public function toArray()
    {
        return $this->event;
    }
}


================================================
FILE: src/HasAwsContext.php
================================================
<?php

namespace Laravel\Vapor;

trait HasAwsContext
{
    /**
     * Get the current AWS request ID.
     *
     * @return string|null The AWS request ID if available.
     */
    public static function requestId(): ?string
    {
        return $_ENV['AWS_REQUEST_ID'] ?? null;
    }

    /**
     * Get the AWS Lambda function name.
     *
     * @return string|null The Lambda function name if available.
     */
    public static function functionName(): ?string
    {
        return $_ENV['AWS_LAMBDA_FUNCTION_NAME'] ?? null;
    }

    /**
     * Get the AWS Lambda function version.
     *
     * @return string|null The Lambda function version if available.
     */
    public static function functionVersion(): ?string
    {
        return $_ENV['AWS_LAMBDA_FUNCTION_VERSION'] ?? null;
    }

    /**
     * Get the AWS CloudWatch log group name.
     *
     * @return string|null The CloudWatch log group name if available.
     */
    public static function logGroupName(): ?string
    {
        return $_ENV['AWS_LAMBDA_LOG_GROUP_NAME'] ?? null;
    }

    /**
     * Get the AWS CloudWatch log stream name.
     *
     * @return string|null The CloudWatch log stream name if available.
     */
    public static function logStreamName(): ?string
    {
        return $_ENV['AWS_LAMBDA_LOG_STREAM_NAME'] ?? null;
    }

    /**
     * Get the AWS execution context for the current Vapor environment.
     *
     * @return array{
     *     request_id: string|null,
     *     function_name: string|null,
     *     function_version: string|null,
     *     log_group_name: string|null,
     *     log_stream_name: string|null
     * }
     */
    protected function awsContext(): array
    {
        return [
            'request_id' => self::requestId(),
            'function_name' => self::functionName(),
            'function_version' => self::functionVersion(),
            'log_group_name' => self::logGroupName(),
            'log_stream_name' => self::logStreamName(),
        ];
    }
}


================================================
FILE: src/Http/Controllers/SignedStorageUrlController.php
================================================
<?php

namespace Laravel\Vapor\Http\Controllers;

use Aws\S3\S3Client;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Laravel\Vapor\Contracts\SignedStorageUrlController as SignedStorageUrlControllerContract;

class SignedStorageUrlController extends Controller implements SignedStorageUrlControllerContract
{
    /**
     * Create a new signed URL.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function store(Request $request)
    {
        $this->ensureEnvironmentVariablesAreAvailable($request);

        Gate::authorize('uploadFiles', [
            $request->user(),
            $bucket = $request->input('bucket') ?: $_ENV['AWS_BUCKET'],
        ]);

        $client = $this->storageClient();

        $uuid = (string) Str::uuid();

        $expiresAfter = config('vapor.signed_storage_url_expires_after', 5);

        $signedRequest = $client->createPresignedRequest(
            $this->createCommand($request, $client, $bucket, $key = $this->getKey($uuid)),
            sprintf('+%s minutes', $expiresAfter)
        );

        $uri = $signedRequest->getUri();

        return response()->json([
            'uuid' => $uuid,
            'bucket' => $bucket,
            'key' => $key,
            'url' => $uri->getScheme().'://'.$uri->getAuthority().$uri->getPath().'?'.$uri->getQuery(),
            'headers' => $this->headers($request, $signedRequest),
        ], 201);
    }

    /**
     * Create a command for the PUT operation.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Aws\S3\S3Client  $client
     * @param  string  $bucket
     * @param  string  $key
     * @return \Aws\Command
     */
    protected function createCommand(Request $request, S3Client $client, $bucket, $key)
    {
        return $client->getCommand('putObject', array_filter([
            'Bucket' => $bucket,
            'Key' => $key,
            'ACL' => $request->input('visibility') ?: $this->defaultVisibility(),
            'ContentType' => $request->input('content_type') ?: 'application/octet-stream',
            'CacheControl' => $request->input('cache_control') ?: null,
            'Expires' => $request->input('expires') ?: null,
        ]));
    }

    /**
     * Get the headers that should be used when making the signed request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \GuzzleHttp\Psr7\Request
     * @return array
     */
    protected function headers(Request $request, $signedRequest)
    {
        return array_merge(
            $signedRequest->getHeaders(),
            [
                'Content-Type' => $request->input('content_type') ?: 'application/octet-stream',
            ]
        );
    }

    /**
     * Ensure the required environment variables are available.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return void
     */
    protected function ensureEnvironmentVariablesAreAvailable(Request $request)
    {
        $missing = array_diff_key(array_flip(array_filter([
            $request->input('bucket') ? null : 'AWS_BUCKET',
            'AWS_DEFAULT_REGION',
            'AWS_ACCESS_KEY_ID',
            'AWS_SECRET_ACCESS_KEY',
        ])), $_ENV);

        if (empty($missing)) {
            return;
        }

        throw new InvalidArgumentException(
            'Unable to issue signed URL. Missing environment variables: '.implode(', ', array_keys($missing))
        );
    }

    /**
     * Get the S3 storage client instance.
     *
     * @return \Aws\S3\S3Client
     */
    protected function storageClient()
    {
        $config = [
            'region' => config('filesystems.disks.s3.region', $_ENV['AWS_DEFAULT_REGION']),
            'version' => 'latest',
            'signature_version' => 'v4',
            'use_path_style_endpoint' => config('filesystems.disks.s3.use_path_style_endpoint', false),
        ];

        if (! isset($_ENV['AWS_LAMBDA_FUNCTION_VERSION'])) {
            $config['credentials'] = array_filter([
                'key' => $_ENV['AWS_ACCESS_KEY_ID'] ?? null,
                'secret' => $_ENV['AWS_SECRET_ACCESS_KEY'] ?? null,
                'token' => $_ENV['AWS_SESSION_TOKEN'] ?? null,
            ]);

            if (array_key_exists('AWS_URL', $_ENV) && ! is_null($_ENV['AWS_URL'])) {
                $config['url'] = $_ENV['AWS_URL'];
                $config['endpoint'] = $_ENV['AWS_URL'];
            }

            if (array_key_exists('AWS_ENDPOINT', $_ENV) && ! is_null($_ENV['AWS_ENDPOINT'])) {
                $config['endpoint'] = $_ENV['AWS_ENDPOINT'];
            }
        }

        return new S3Client($config);
    }

    /**
     * Get key for the given UUID.
     *
     * @param  string  $uuid
     * @return string
     */
    protected function getKey(string $uuid)
    {
        return 'tmp/'.$uuid;
    }

    /**
     * Get the default visibility for uploads.
     *
     * @return string
     */
    protected function defaultVisibility()
    {
        return 'private';
    }
}


================================================
FILE: src/Http/Middleware/ServeStaticAssets.php
================================================
<?php

namespace Laravel\Vapor\Http\Middleware;

use Closure;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;

class ServeStaticAssets
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  ...$guards
     * @return mixed
     */
    public function handle($request, Closure $next, ...$guards)
    {
        $response = $next($request);

        if (isset($_ENV['VAPOR_SSM_PATH']) && $response->getStatusCode() === 404) {
            $requestUri = $request->getRequestUri();

            if (! in_array(ltrim($requestUri, '/'), config('vapor.serve_assets', []))) {
                return $response;
            }

            $asset = null;

            try {
                $asset = (new Client)->get(asset($requestUri));
            } catch (ClientException $e) {
                report($e);
            }

            if ($asset && $asset->getStatusCode() === 200) {
                $headers = collect($asset->getHeaders())
                    ->only(['Content-Length', 'Content-Type'])
                    ->all();

                return response($asset->getBody())->withHeaders($headers);
            }
        }

        return $response;
    }
}


================================================
FILE: src/Logging/JsonFormatter.php
================================================
<?php

namespace Laravel\Vapor\Logging;

use Monolog\Formatter\JsonFormatter as BaseJsonFormatter;
use Monolog\LogRecord;

class JsonFormatter extends BaseJsonFormatter
{
    /**
     * {@inheritdoc}
     */
    public function format($record): string
    {
        $context = ['aws_request_id' => ($_ENV['AWS_REQUEST_ID'] ?? null)];

        if ($record instanceof LogRecord) {
            $record = new LogRecord(
                $record->datetime,
                $record->channel,
                $record->level,
                $record->message,
                array_merge($record->context, $context),
                $record->extra,
                $record->formatted
            );
        } else {
            $record['context'] = array_merge(
                $record['context'] ?? [], $context
            );
        }

        return parent::format($record);
    }
}


================================================
FILE: src/Queue/JobAttempts.php
================================================
<?php

namespace Laravel\Vapor\Queue;

use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Queue\Job;

class JobAttempts
{
    /**
     * The number of seconds job attempts should remain on cache.
     */
    const TTL = 1209600;

    /**
     * The cache repository implementation.
     *
     * @var \Illuminate\Contracts\Cache\Repository
     */
    protected $cache;

    /**
     * Create a new job attempts instance.
     *
     * @param  \Illuminate\Contracts\Cache\Repository  $cache
     * @return void
     */
    public function __construct(Cache $cache)
    {
        $this->cache = $cache;
    }

    /**
     * Determine if the job have been attempted before.
     *
     * @param  \Illuminate\Contracts\Queue\Job|string  $job
     * @return bool
     */
    protected function has($job)
    {
        return ! is_null($this->cache->get($this->key($job)));
    }

    /**
     * Get the number of times the job has been attempted.
     *
     * @param  \Illuminate\Contracts\Queue\Job|string  $job
     * @return int
     */
    public function get($job)
    {
        return (int) $this->cache->get($this->key($job), 0);
    }

    /**
     * Increment the number of times the job has been attempted.
     *
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @return void
     */
    public function increment($job)
    {
        if ($this->has($job)) {
            $this->cache->increment($this->key($job));

            return;
        }

        $this->cache->put($this->key($job), 1, static::TTL);
    }

    /**
     * Transfer the job attempts from one job to another.
     *
     * @param  \Illuminate\Contracts\Queue\Job|string  $from
     * @param  \Illuminate\Contracts\Queue\Job|string  $to
     * @return void
     */
    public function transfer($from, $to)
    {
        $this->cache->put($this->key($to), $this->get($from), static::TTL);

        $this->cache->forget($this->key($from));
    }

    /**
     * Forget the number of times the job has been attempted.
     *
     * @param  \Illuminate\Contracts\Queue\Job|string  $job
     * @return null
     */
    public function forget($job)
    {
        $this->cache->forget($this->key($job));
    }

    /**
     * Gets the cache key for the given job.
     *
     * @param  \Illuminate\Contracts\Queue\Job|string  $job
     * @return string
     */
    protected function key($job)
    {
        $jobId = $job instanceof Job ? $job->getJobId() : $job;

        return 'laravel_vapor_job_attempts:'.$jobId;
    }
}


================================================
FILE: src/Queue/VaporConnector.php
================================================
<?php

namespace Laravel\Vapor\Queue;

use Aws\Sqs\SqsClient;
use Illuminate\Queue\Connectors\ConnectorInterface;
use Illuminate\Support\Arr;

class VaporConnector implements ConnectorInterface
{
    /**
     * Establish a queue connection.
     *
     * @param  array  $config
     * @return \Illuminate\Contracts\Queue\Queue
     */
    public function connect(array $config)
    {
        $config = $this->getDefaultConfiguration($config);

        if ($config['key'] && $config['secret']) {
            $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
        }

        return new VaporQueue(
            new SqsClient($config),
            $config['queue'],
            $config['prefix'] ?? '',
            $config['suffix'] ?? '',
            $config['after_commit'] ?? null
        );
    }

    /**
     * Get the default configuration for SQS.
     *
     * @param  array  $config
     * @return array
     */
    protected function getDefaultConfiguration(array $config)
    {
        return array_merge([
            'version' => 'latest',
            'http' => [
                'timeout' => 60,
                'connect_timeout' => 60,
            ],
        ], $config);
    }
}


================================================
FILE: src/Queue/VaporJob.php
================================================
<?php

namespace Laravel\Vapor\Queue;

use Illuminate\Queue\Jobs\SqsJob;

class VaporJob extends SqsJob
{
    /**
     * Get the number of times the job has been attempted.
     *
     * @return int
     */
    public function attempts()
    {
        return max(
            ($this->payload()['attempts'] ?? 0) + 1,
            $this->container->make(JobAttempts::class)->get($this)
        );
    }

    /**
     * Delete the job from the queue.
     *
     * @return void
     */
    public function delete()
    {
        parent::delete();

        $this->container
             ->make(JobAttempts::class)
             ->forget($this);
    }

    /**
     * Release the job back into the queue.
     *
     * @param  int  $delay
     * @return void
     */
    public function release($delay = 0)
    {
        $this->released = true;

        $payload = $this->payload();

        $payload['attempts'] = $this->attempts();

        $this->sqs->deleteMessage([
            'QueueUrl' => $this->queue,
            'ReceiptHandle' => $this->job['ReceiptHandle'],
        ]);

        $jobId = $this->sqs->sendMessage([
            'QueueUrl' => $this->queue,
            'MessageBody' => json_encode($payload),
            'DelaySeconds' => $this->secondsUntil($delay),
        ])->get('MessageId');

        $this->container
             ->make(JobAttempts::class)
             ->transfer($this, $jobId);
    }
}


================================================
FILE: src/Queue/VaporQueue.php
================================================
<?php

namespace Laravel\Vapor\Queue;

use Illuminate\Queue\SqsQueue;

class VaporQueue extends SqsQueue
{
    /**
     * Pop the next job off of the queue.
     *
     * @param  string  $queue
     * @return \Illuminate\Contracts\Queue\Job|null
     */
    public function pop($queue = null)
    {
        $response = $this->sqs->receiveMessage([
            'QueueUrl' => $queue = $this->getQueue($queue),
            'AttributeNames' => ['ApproximateReceiveCount'],
        ]);

        if (! is_null($response['Messages']) && count($response['Messages']) > 0) {
            return tap(new VaporJob(
                $this->container, $this->sqs, $response['Messages'][0],
                $this->connectionName, $queue
            ), function ($job) {
                $this->container
                     ->make(JobAttempts::class)
                     ->increment($job);
            });
        }
    }

    /**
     * Create a payload string from the given job and data.
     *
     * @param  string  $job
     * @param  string  $queue
     * @param  mixed  $data
     * @return array
     */
    protected function createPayloadArray($job, $queue, $data = '')
    {
        return array_merge(parent::createPayloadArray($job, $queue, $data), [
            'attempts' => 0,
        ]);
    }
}


================================================
FILE: src/Queue/VaporWorker.php
================================================
<?php

namespace Laravel\Vapor\Queue;

use Illuminate\Queue\Worker;
use Illuminate\Queue\WorkerOptions;
use Laravel\Vapor\VaporJobTimedOutException;

class VaporWorker extends Worker
{
    /**
     * Process the given job.
     *
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  string  $connectionName
     * @param  \Illuminate\Queue\WorkerOptions  $options
     * @return void
     */
    public function runVaporJob($job, $connectionName, WorkerOptions $options)
    {
        app()->forgetScopedInstances();

        pcntl_async_signals(true);

        pcntl_signal(SIGALRM, function () use ($job) {
            throw new VaporJobTimedOutException($job->resolveName());
        });

        pcntl_alarm(
            max($this->timeoutForJob($job, $options), 0)
        );

        app(JobAttempts::class)->increment($job);

        $this->runJob($job, $connectionName, $options);

        pcntl_alarm(0);
    }
}


================================================
FILE: src/Runtime/ArrayLambdaResponse.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Laravel\Vapor\Contracts\LambdaResponse;

class ArrayLambdaResponse implements LambdaResponse
{
    /**
     * The response array.
     *
     * @var array
     */
    protected $response;

    /**
     * Create a new response instance.
     *
     * @param  array  $response
     * @return void
     */
    public function __construct(array $response)
    {
        $this->response = $response;
    }

    /**
     * Convert the response to API Gateway's supported format.
     *
     * @return array
     */
    public function toApiGatewayFormat()
    {
        return $this->response;
    }
}


================================================
FILE: src/Runtime/CliHandlerFactory.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Laravel\Vapor\Runtime\Handlers\CliHandler;
use Laravel\Vapor\Runtime\Handlers\QueueHandler;

class CliHandlerFactory
{
    /**
     * The custom handler factory callback.
     *
     * @var callable|null
     */
    protected static $customHandlerFactory;

    /**
     * Create a new handler for the given CLI event.
     *
     * @param  array  $event
     * @return mixed
     */
    public static function make(array $event)
    {
        if (static::$customHandlerFactory) {
            return call_user_func(static::$customHandlerFactory, $event);
        }

        $messageId = $event['Records'][0]['messageId'] ?? null;

        $job = json_decode($event['Records'][0]['body'] ?? '')->job ?? null;

        return $messageId && $job
                    ? new QueueHandler
                    : new CliHandler;
    }

    /**
     * Set a custom handler factory callback.
     *
     * @param  callable  $callback
     * @return void
     */
    public static function createHandlerUsing(callable $callback)
    {
        static::$customHandlerFactory = $callback;
    }

    /**
     * Reset the handler factory to its default behavior.
     *
     * @return void
     */
    public static function createHandlersNormally()
    {
        static::$customHandlerFactory = null;
    }
}


================================================
FILE: src/Runtime/Environment.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Dotenv\Dotenv;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Contracts\Foundation\Application;
use Throwable;

class Environment
{
    /**
     * The writable path for the environment file.
     *
     * @var string
     */
    protected $writePath = '/tmp';

    /**
     * The application instance.
     *
     * @var \Illuminate\Contracts\Foundation\Application
     */
    protected $app;

    /**
     * The environment name.
     *
     * @var string
     */
    protected $environment;

    /**
     * The environment file name.
     *
     * @var string
     */
    protected $environmentFile;

    /**
     * The encrypted environment file name.
     *
     * @var string
     */
    protected $encryptedFile;

    /**
     * The console kernel instance.
     *
     * @var \Illuminate\Contracts\Console\Kernel
     */
    protected $console;

    /**
     * Create a new environment manager instance.
     *
     * @return void
     */
    public function __construct(Application $app)
    {
        $this->app = $app;

        $this->environment = $_ENV['VAPOR_ENV'] ?? $_ENV['APP_ENV'] ?? 'production';
        $this->environmentFile = '.env.'.$this->environment;
        $this->encryptedFile = '.env.'.$this->environment.'.encrypted';
    }

    /**
     * Decrypt the environment file and load it into the runtime.
     *
     * @return void
     */
    public static function decrypt($app)
    {
        (new static($app))->decryptEnvironment();
    }

    /**
     * Decrypt the environment file and load it into the runtime.
     *
     * @return void
     */
    public function decryptEnvironment()
    {
        try {
            if (! $this->canBeDecrypted()) {
                return;
            }

            $this->copyEncryptedFile();

            $this->decryptFile();

            $this->loadEnvironment();
        } catch (Throwable $e) {
            function_exists('__vapor_debug') && __vapor_debug($e->getMessage());
        }
    }

    /**
     * Determine if it is possible to decrypt the environment file.
     *
     * @return bool
     */
    public function canBeDecrypted()
    {
        if (! isset($_ENV['LARAVEL_ENV_ENCRYPTION_KEY'])) {
            return false;
        }

        if (version_compare($this->app->version(), '9.37.0', '<')) {
            function_exists('__vapor_debug') && __vapor_debug('Decrypt command not available.');

            return false;
        }

        if (! file_exists($this->app->basePath($this->encryptedFile))) {
            function_exists('__vapor_debug') && __vapor_debug('Encrypted environment file not found.');

            return false;
        }

        return true;
    }

    /**
     * Copy the encrypted environment file to the writable path.
     *
     * @return void
     */
    public function copyEncryptedFile()
    {
        copy(
            $this->app->basePath($this->encryptedFile),
            $this->writePath.DIRECTORY_SEPARATOR.$this->encryptedFile
        );
    }

    /**
     * Decrypt the environment file.
     *
     * @return void
     */
    public function decryptFile()
    {
        function_exists('__vapor_debug') && __vapor_debug('Decrypting environment variables.');

        $this->console()->call('env:decrypt', ['--env' => $this->environment, '--path' => $this->writePath]);
    }

    /**
     * Load the decrypted environment file.
     *
     * @return void
     */
    public function loadEnvironment()
    {
        function_exists('__vapor_debug') && __vapor_debug('Loading decrypted environment variables.');

        Dotenv::createMutable($this->writePath, $this->environmentFile)->load();
    }

    /**
     * Get the console kernel implementation.
     *
     * @return \Illuminate\Contracts\Console\Kernel
     */
    public function console()
    {
        if (! $this->console) {
            $this->console = $this->app->make(Kernel::class);
        }

        return $this->console;
    }
}


================================================
FILE: src/Runtime/Fpm/ActsAsFastCgiDataProvider.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

trait ActsAsFastCgiDataProvider
{
    /**
     * {@inheritdoc}
     */
    public function getGatewayInterface(): string
    {
        return 'FastCGI/1.0';
    }

    /**
     * {@inheritdoc}
     */
    public function getRequestMethod(): string
    {
        return $this->serverVariables['REQUEST_METHOD'];
    }

    /**
     * {@inheritdoc}
     */
    public function getScriptFilename(): string
    {
        return $this->serverVariables['SCRIPT_FILENAME'];
    }

    /**
     * {@inheritdoc}
     */
    public function getServerSoftware(): string
    {
        return 'vapor';
    }

    /**
     * {@inheritdoc}
     */
    public function getRemoteAddress(): string
    {
        return $this->serverVariables['REMOTE_ADDR'];
    }

    /**
     * {@inheritdoc}
     */
    public function getRemotePort(): int
    {
        return $this->serverVariables['SERVER_PORT'];
    }

    /**
     * {@inheritdoc}
     */
    public function getServerAddress(): string
    {
        return $this->serverVariables['SERVER_ADDR'];
    }

    /**
     * {@inheritdoc}
     */
    public function getServerPort(): int
    {
        return $this->serverVariables['SERVER_PORT'];
    }

    /**
     * {@inheritdoc}
     */
    public function getServerName(): string
    {
        return $this->serverVariables['SERVER_NAME'];
    }

    /**
     * {@inheritdoc}
     */
    public function getServerProtocol(): string
    {
        return $this->serverVariables['SERVER_PROTOCOL'];
    }

    /**
     * {@inheritdoc}
     */
    public function getContentType(): string
    {
        return $this->serverVariables['CONTENT_TYPE'];
    }

    /**
     * {@inheritdoc}
     */
    public function getContentLength(): int
    {
        $contentLength = $this->serverVariables['CONTENT_LENGTH'] ?: 0;

        return is_numeric($contentLength) ? (int) $contentLength : 0;
    }

    /**
     * {@inheritdoc}
     */
    public function getContent(): string
    {
        return $this->body;
    }

    /**
     * {@inheritdoc}
     */
    public function getCustomVars(): array
    {
        return $this->serverVariables;
    }

    /**
     * {@inheritdoc}
     */
    public function getParams(): array
    {
        return $this->serverVariables;
    }

    /**
     * {@inheritdoc}
     */
    public function getRequestUri(): string
    {
        return $this->serverVariables['PATH_INFO'];
    }

    /**
     * {@inheritdoc}
     */
    public function getResponseCallbacks(): array
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getFailureCallbacks(): array
    {
        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function getPassThroughCallbacks(): array
    {
        return [];
    }
}


================================================
FILE: src/Runtime/Fpm/Fpm.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

use Exception;
use hollodotme\FastCGI\Client;
use hollodotme\FastCGI\SocketConnections\UnixDomainSocket;
use Symfony\Component\Process\Process;
use Throwable;

class Fpm
{
    public const SOCKET = '/tmp/.vapor/php-fpm.sock';

    public const CONFIG = '/tmp/.vapor/php-fpm.conf';

    public const PID_FILE = '/tmp/.vapor/php-fpm.pid';

    /**
     * The static FPM instance for the container.
     *
     * @var static
     */
    protected static $instance;

    /**
     * The file that should be invoked by FPM.
     *
     * @var string
     */
    protected $handler;

    /**
     * The additional server variables that should be passed to FPM.
     *
     * @var array
     */
    protected $serverVariables = [];

    /**
     * The FPM socket client instance.
     *
     * @var \Hoa\Socket\Client
     */
    protected $client;

    /**
     * The FPM socket connection instance.
     *
     * @var \Hoa\FastCGI\SocketConnections\UnixDomainSocket
     */
    protected $socketConnection;

    /**
     * The FPM process instance.
     *
     * @var \Symfony\Component\Process\Process
     */
    protected $fpm;

    /**
     * Create a new FPM instance.
     *
     * @param  \Hoa\Socket\Client  $handler
     * @param  \Hoa\FastCGI\SocketConnections\UnixDomainSocket  $socketConnection
     * @return void
     */
    public function __construct(Client $client, UnixDomainSocket $socketConnection, string $handler, array $serverVariables = [])
    {
        $this->client = $client;
        $this->handler = $handler;
        $this->serverVariables = $serverVariables;
        $this->socketConnection = $socketConnection;
    }

    /**
     * Boot FPM with the given handler.
     *
     * @param  string  $handler
     * @return static
     */
    public static function boot($handler, array $serverVariables = [])
    {
        if (file_exists(static::SOCKET)) {
            @unlink(static::SOCKET);
        }

        $socketConnection = new UnixDomainSocket(self::SOCKET, 1000, 900000);

        return static::$instance = tap(new static(new Client, $socketConnection, $handler, $serverVariables), function ($fpm) {
            $fpm->start();
        });
    }

    /**
     * Resolve the static FPM instance.
     *
     * @return static
     */
    public static function resolve()
    {
        return static::$instance;
    }

    /**
     * Start the PHP-FPM process.
     */
    public function start()
    {
        if ($this->isReady()) {
            $this->killExistingFpm();
        }

        function_exists('__vapor_debug') && __vapor_debug('Ensuring ready to start FPM');

        $this->ensureReadyToStart();

        $this->fpm = new Process([
            'php-fpm',
            '--nodaemonize',
            '--force-stderr',
            '--fpm-config',
            self::CONFIG,
        ]);

        function_exists('__vapor_debug') && __vapor_debug('Starting FPM Process...');

        $this->fpm->disableOutput()
            ->setTimeout(null)
            ->start(function ($type, $output) {
                fwrite(STDERR, $output.PHP_EOL);
            });

        $this->ensureFpmHasStarted();
    }

    /**
     * Ensure that the proper configuration is in place to start FPM.
     *
     * @return void
     */
    protected function ensureReadyToStart()
    {
        if (! is_dir(dirname(self::SOCKET))) {
            mkdir(dirname(self::SOCKET));
        }

        if (! file_exists(self::CONFIG)) {
            file_put_contents(
                self::CONFIG,
                file_get_contents(__DIR__.'/../../../stubs/php-fpm.conf')
            );
        }
    }

    /**
     * Proxy the request to PHP-FPM and return its response.
     *
     * @param  \Laravel\Vapor\Runtime\Fpm\FpmRequest  $request
     * @return \Laravel\Vapor\Runtime\Fpm\FpmResponse
     */
    public function handle($request)
    {
        return (new FpmApplication($this->client, $this->socketConnection))
            ->handle($request);
    }

    /**
     * Wait until the FPM process is ready to receive requests.
     *
     * @return void
     */
    protected function ensureFpmHasStarted()
    {
        $elapsed = 0;

        while (! $this->isReady()) {
            usleep(5000);

            $elapsed += 5000;

            if ($elapsed > ($fiveSeconds = 5000000)) {
                throw new Exception('Timed out waiting for FPM to start: '.self::SOCKET);
            }

            if (! $this->fpm->isRunning()) {
                throw new Exception('PHP-FPM was unable to start.');
            }
        }
    }

    /**
     * Determine is the FPM process is ready to receive requests.
     *
     * @return bool
     */
    protected function isReady()
    {
        clearstatcache(false, self::SOCKET);

        return file_exists(self::SOCKET);
    }

    /**
     * Ensure that the FPM process is still running.
     *
     * @return void
     *
     * @throws \Exception
     */
    public function ensureRunning()
    {
        try {
            if (! $this->fpm || ! $this->fpm->isRunning()) {
                throw new Exception('PHP-FPM has stopped unexpectedly.');
            }
        } catch (Throwable $e) {
            function_exists('__vapor_debug') && __vapor_debug($e->getMessage());

            exit(1);
        }
    }

    /**
     * Stop the FPM process.
     *
     * @return void
     */
    public function stop()
    {
        if ($this->fpm && $this->fpm->isRunning()) {
            $this->fpm->stop();
        }
    }

    /**
     * Kill any existing FPM processes on the system.
     *
     * @return void
     */
    protected function killExistingFpm()
    {
        function_exists('__vapor_debug') && __vapor_debug('Killing existing FPM');

        if (! file_exists(static::PID_FILE)) {
            return unlink(static::SOCKET);
        }

        $pid = (int) file_get_contents(static::PID_FILE);

        if (posix_getpgid($pid) === false) {
            return $this->removeFpmProcessFiles();
        }

        $result = posix_kill($pid, SIGTERM);

        if ($result === false) {
            return $this->removeFpmProcessFiles();
        }

        $this->waitUntilStopped($pid);

        $this->removeFpmProcessFiles();
    }

    /**
     * Remove FPM's process related files.
     *
     * @return void
     */
    protected function removeFpmProcessFiles()
    {
        unlink(static::SOCKET);
        unlink(static::PID_FILE);
    }

    /**
     * Wait until the given process is stopped.
     *
     * @param  int  $pid
     * @return void
     */
    protected function waitUntilStopped($pid)
    {
        $elapsed = 0;

        while (posix_getpgid($pid) !== false) {
            usleep(5000);

            $elapsed += 5000;

            if ($elapsed > 1000000) {
                throw new Exception('Process did not stop within the given threshold.');
            }
        }
    }

    /**
     * Get the underlying process.
     *
     * @return \Symfony\Component\Process\Process
     */
    public function process()
    {
        return $this->fpm;
    }

    /**
     * Get the handler.
     *
     * @return string
     */
    public function handler()
    {
        return $this->handler;
    }

    /**
     * Get the server variables.
     *
     * @return array
     */
    public function serverVariables()
    {
        return $this->serverVariables;
    }

    /**
     * Handle the destruction of the class.
     *
     * @return void
     */
    public function __destruct()
    {
        $this->stop();
    }
}


================================================
FILE: src/Runtime/Fpm/FpmApplication.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

use hollodotme\FastCGI\Client;
use hollodotme\FastCGI\SocketConnections\UnixDomainSocket;

class FpmApplication
{
    /**
     * The socket client instance.
     *
     * @var \Hoa\Socket\Client
     */
    protected $client;

    /**
     * The FPM socket connection instance.
     *
     * @var \Hoa\FastCGI\SocketConnections\UnixDomainSocket
     */
    protected $socketConnection;

    /**
     * Create a new FPM application instance.
     *
     * @param  \hollodotme\FastCGI\Client  $client
     * @param  \Hoa\FastCGI\SocketConnections\UnixDomainSocket  $socketConnection
     * @return void
     */
    public function __construct(Client $client, UnixDomainSocket $socketConnection)
    {
        $this->client = $client;
        $this->socketConnection = $socketConnection;
    }

    /**
     * Handle the given FPM request.
     *
     * @param  \Laravel\Vapor\Runtime\Fpm\FpmRequest  $request
     * @return \Laravel\Vapor\Runtime\Fpm\FpmResponse
     */
    public function handle(FpmRequest $request)
    {
        return new FpmResponse(
            $this->client->sendRequest($this->socketConnection, $request)
        );
    }
}


================================================
FILE: src/Runtime/Fpm/FpmHttpHandlerFactory.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

use Laravel\Vapor\Runtime\Handlers\FpmHandler;
use Laravel\Vapor\Runtime\Handlers\LoadBalancedFpmHandler;
use Laravel\Vapor\Runtime\Handlers\PayloadFormatVersion2FpmHandler;
use Laravel\Vapor\Runtime\Handlers\UnknownEventHandler;
use Laravel\Vapor\Runtime\Handlers\WarmerHandler;
use Laravel\Vapor\Runtime\Handlers\WarmerPingHandler;

class FpmHttpHandlerFactory
{
    /**
     * Create a new handler for the given HTTP event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaEventHandler
     */
    public static function make(array $event)
    {
        if (isset($event['vaporWarmer'])) {
            return new WarmerHandler;
        } elseif (isset($event['vaporWarmerPing'])) {
            return new WarmerPingHandler;
        } elseif (isset($event['requestContext']['elb'])) {
            return new LoadBalancedFpmHandler;
        } elseif (isset($event['version']) && $event['version'] === '2.0') {
            return new PayloadFormatVersion2FpmHandler;
        } elseif (isset($event['httpMethod']) || isset($event['requestContext']['http']['method'])) {
            return new FpmHandler;
        }

        return new UnknownEventHandler;
    }
}


================================================
FILE: src/Runtime/Fpm/FpmRequest.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

use hollodotme\FastCGI\Interfaces\ProvidesRequestData;
use Laravel\Vapor\Runtime\Request;

class FpmRequest extends Request implements ProvidesRequestData
{
    use ActsAsFastCgiDataProvider;
}


================================================
FILE: src/Runtime/Fpm/FpmResponse.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

use hollodotme\FastCGI\Interfaces\ProvidesResponseData;
use Laravel\Vapor\Runtime\Response;

class FpmResponse extends Response
{
    /**
     * Create a new FPM response instance.
     *
     * @param  \hollodotme\FastCGI\Interfaces\ProvidesResponseData  $response
     * @return void
     */
    public function __construct(ProvidesResponseData $response)
    {
        $headers = FpmResponseHeaders::fromBody($response->getOutput());

        parent::__construct(
            $response->getBody(),
            $headers,
            $this->prepareStatus($headers)
        );
    }

    /**
     * Prepare the status code of the response.
     *
     * @return int
     */
    protected function prepareStatus(array $headers)
    {
        $headers = array_change_key_case($headers, CASE_LOWER);

        return isset($headers['status'][0])
            ? (int) explode(' ', $headers['status'][0])[0]
            : 200;
    }
}


================================================
FILE: src/Runtime/Fpm/FpmResponseHeaders.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Fpm;

class FpmResponseHeaders
{
    /**
     * Extract the response headers from the raw response.
     *
     * @param  string  $body
     * @return array
     */
    public static function fromBody($body)
    {
        $headers = [];

        foreach (explode(PHP_EOL, $body) as $line) {
            if (preg_match('#^([^\:]+):(.*)$#', $line, $matches)) {
                $headers[trim($matches[1])][] = trim($matches[2]);

                continue;
            }

            break;
        }

        return $headers;
    }
}


================================================
FILE: src/Runtime/Handlers/CliHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use GuzzleHttp\Client;
use Illuminate\Support\Str;
use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\ArrayLambdaResponse;
use Symfony\Component\Process\Process;
use Throwable;

class CliHandler implements LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        $output = '';

        $process = Process::fromShellCommandline(
            $command = sprintf('php %s/artisan %s --no-interaction 2>&1',
                $_ENV['LAMBDA_TASK_ROOT'],
                trim($event['cli'] ?? 'vapor:handle '.base64_encode(json_encode($event)))
            )
        )->setTimeout(null);

        $process->run(function ($type, $line) use (&$output) {
            if (! Str::containsAll($line, ['{"message":', '"level":'])) {
                $output .= $line;
            } else {
                echo $line.PHP_EOL;
            }
        });

        echo $output = json_encode([
            'output' => $output,
            'context' => [
                'command' => $command,
                'aws_request_id' => $_ENV['AWS_REQUEST_ID'] ?? null,
            ],
        ]);

        return new ArrayLambdaResponse(tap([
            'requestId' => $_ENV['AWS_REQUEST_ID'] ?? null,
            'logGroup' => $_ENV['AWS_LAMBDA_LOG_GROUP_NAME'] ?? null,
            'logStream' => $_ENV['AWS_LAMBDA_LOG_STREAM_NAME'] ?? null,
            'statusCode' => $process->getExitCode(),
            'output' => base64_encode($output),
        ], function ($response) use ($event) {
            $this->ping($event['callback'] ?? null, $response);
        }));
    }

    /**
     * Ping the given callback URL.
     *
     * @param  string  $callback
     * @param  array  $response
     * @return void
     */
    protected function ping($callback, $response)
    {
        if (! isset($callback)) {
            return;
        }

        try {
            (new Client)->post($callback, ['json' => $response]);
        } catch (Throwable $e) {
            //
        }
    }
}


================================================
FILE: src/Runtime/Handlers/FpmHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\Fpm\Fpm;
use Laravel\Vapor\Runtime\Fpm\FpmRequest;
use Laravel\Vapor\Runtime\LambdaResponse;

class FpmHandler implements LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        return $this->response(
            Fpm::resolve()->handle($this->request($event))
        );
    }

    /**
     * Create a new fpm request from the incoming event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Runtime\Fpm\FpmRequest
     */
    public function request($event)
    {
        return FpmRequest::fromLambdaEvent(
            $event, $this->serverVariables(), Fpm::resolve()->handler()
        );
    }

    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LambdaResponse
     */
    public function response($response)
    {
        return new LambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }

    /**
     * Get the server variables.
     *
     * @return array
     */
    public function serverVariables()
    {
        return array_merge(Fpm::resolve()->serverVariables(), array_filter([
            'AWS_REQUEST_ID' => $_ENV['AWS_REQUEST_ID'] ?? null,
        ]));
    }
}


================================================
FILE: src/Runtime/Handlers/LoadBalancedFpmHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Runtime\LoadBalancedLambdaResponse;

class LoadBalancedFpmHandler extends FpmHandler
{
    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LoadBalancedLambdaResponse
     */
    public function response($response)
    {
        return new LoadBalancedLambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }
}


================================================
FILE: src/Runtime/Handlers/LoadBalancedOctaneHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Runtime\LoadBalancedLambdaResponse;

class LoadBalancedOctaneHandler extends OctaneHandler
{
    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LoadBalancedLambdaResponse
     */
    public function response($response)
    {
        return new LoadBalancedLambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }
}


================================================
FILE: src/Runtime/Handlers/OctaneHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Octane\MarshalsPsr7RequestsAndResponses;
use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\LambdaResponse;
use Laravel\Vapor\Runtime\Octane\Octane;
use Laravel\Vapor\Runtime\Octane\OctaneRequestContextFactory;

class OctaneHandler implements LambdaEventHandler
{
    use MarshalsPsr7RequestsAndResponses;

    /**
     * Handle an incoming Lambda event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        $request = $this->request($event);

        return $this->response(
            Octane::handle($request)
        );
    }

    /**
     * Create a new Octane request from the incoming event.
     *
     * @param  array  $event
     * @return \Laravel\Octane\RequestContext
     */
    protected function request($event)
    {
        return OctaneRequestContextFactory::fromEvent($event, $this->serverVariables());
    }

    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LambdaResponse
     */
    protected function response($response)
    {
        return new LambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }

    /**
     * Get the server variables.
     *
     * @return array
     */
    public function serverVariables()
    {
        return [
            'AWS_REQUEST_ID' => $_ENV['AWS_REQUEST_ID'] ?? null,
        ];
    }
}


================================================
FILE: src/Runtime/Handlers/PayloadFormatVersion2FpmHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\PayloadFormatVersion2LambdaResponse;

class PayloadFormatVersion2FpmHandler extends FpmHandler implements LambdaEventHandler
{
    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LambdaResponse
     */
    public function response($response)
    {
        return new PayloadFormatVersion2LambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }
}


================================================
FILE: src/Runtime/Handlers/PayloadFormatVersion2OctaneHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\PayloadFormatVersion2LambdaResponse;

class PayloadFormatVersion2OctaneHandler extends OctaneHandler implements LambdaEventHandler
{
    /**
     * Covert a response to Lambda-ready response.
     *
     * @param  \Laravel\Vapor\Runtime\Response  $response
     * @return \Laravel\Vapor\Runtime\LambdaResponse
     */
    protected function response($response)
    {
        return new PayloadFormatVersion2LambdaResponse(
            $response->status,
            $response->headers,
            $response->body
        );
    }
}


================================================
FILE: src/Runtime/Handlers/QueueHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Illuminate\Contracts\Console\Kernel;
use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Events\LambdaEvent;
use Laravel\Vapor\Runtime\ArrayLambdaResponse;
use Laravel\Vapor\Runtime\StorageDirectories;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;

class QueueHandler implements LambdaEventHandler
{
    /**
     * The cached application instance.
     *
     * @var \Illuminate\Foundation\Application
     */
    public static $app;

    /**
     * Create a new Queue handler instance.
     *
     * @return void
     */
    public function __construct()
    {
        if (! isset(static::$app)) {
            static::$app = require $_ENV['LAMBDA_TASK_ROOT'].'/bootstrap/app.php';
        }
    }

    /**
     * Handle an incoming Lambda event.
     *
     * @param  array  $event
     * @return ArrayLambdaResponse
     */
    public function handle(array $event)
    {
        $commandOptions = trim(sprintf(
            '--delay=%s --timeout=%s --tries=%s %s',
            $_ENV['SQS_DELAY'] ?? 3,
            $_ENV['QUEUE_TIMEOUT'] ?? 0,
            $_ENV['SQS_TRIES'] ?? 3,
            ($_ENV['SQS_FORCE'] ?? false) ? '--force' : ''
        ));

        try {
            static::$app->useStoragePath(StorageDirectories::PATH);

            $consoleKernel = static::$app->make(Kernel::class);

            static::$app->bind(LambdaEvent::class, function () use ($event) {
                return new LambdaEvent($event);
            });

            $consoleInput = new StringInput(
                'vapor:work '.$commandOptions.' --no-interaction'
            );

            $status = $consoleKernel->handle(
                $consoleInput, $output = new BufferedOutput
            );

            $consoleKernel->terminate($consoleInput, $status);

            return new ArrayLambdaResponse([
                'requestId' => $_ENV['AWS_REQUEST_ID'] ?? null,
                'logGroup' => $_ENV['AWS_LAMBDA_LOG_GROUP_NAME'] ?? null,
                'logStream' => $_ENV['AWS_LAMBDA_LOG_STREAM_NAME'] ?? null,
                'statusCode' => $status,
                'output' => base64_encode($output->fetch()),
            ]);
        } finally {
            unset(static::$app[LambdaEvent::class]);

            $this->terminate();
        }
    }

    /**
     * Terminate any relevant application services.
     *
     * @return void
     */
    protected function terminate()
    {
        if (static::$app->resolved('db') && ($_ENV['VAPOR_QUEUE_DATABASE_SESSION_PERSIST'] ?? false) !== 'true') {
            collect(static::$app->make('db')->getConnections())->each->disconnect();
        }
    }
}


================================================
FILE: src/Runtime/Handlers/UnknownEventHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\ArrayLambdaResponse;
use Laravel\Vapor\Runtime\Logger;

class UnknownEventHandler implements LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        Logger::info('Unknown event type received by application.', [
            'event' => $event,
        ]);

        return new ArrayLambdaResponse([
            'output' => 'Unknown event type.',
        ]);
    }
}


================================================
FILE: src/Runtime/Handlers/WarmerHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Aws\Lambda\LambdaClient;
use GuzzleHttp\Promise\Utils;
use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\ArrayLambdaResponse;
use Laravel\Vapor\Runtime\Logger;
use Throwable;

class WarmerHandler implements LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        try {
            Logger::info('Executing warming requests...');

            Utils::settle(
                $this->buildPromises($this->lambdaClient(), $event)
            )->wait();
        } catch (Throwable $e) {
            Logger::error($e->getMessage(), ['exception' => $e]);
        }

        return new ArrayLambdaResponse([
            'output' => 'Warmer event handled.',
        ]);
    }

    /**
     * Build the array of warmer invocation promises.
     *
     * @return array
     */
    protected function buildPromises(LambdaClient $lambda, array $event)
    {
        return collect(range(1, $event['concurrency'] - 1))
            ->mapWithKeys(function ($i) use ($lambda, $event) {
                return ['warmer-'.$i => $lambda->invokeAsync([
                    'FunctionName' => $event['functionName'],
                    'Qualifier' => $event['functionAlias'],
                    'LogType' => 'None',
                    'Payload' => json_encode(['vaporWarmerPing' => true]),
                ])];
            })->all();
    }

    /**
     * Get the Lambda client instance.
     *
     * @return \Aws\Lambda\LambdaClient
     */
    protected function lambdaClient()
    {
        return new LambdaClient([
            'region' => $_ENV['AWS_DEFAULT_REGION'],
            'version' => 'latest',
            'http' => [
                'timeout' => 5,
                'connect_timeout' => 5,
            ],
        ]);
    }
}


================================================
FILE: src/Runtime/Handlers/WarmerPingHandler.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Handlers;

use Laravel\Vapor\Contracts\LambdaEventHandler;
use Laravel\Vapor\Runtime\ArrayLambdaResponse;

class WarmerPingHandler implements LambdaEventHandler
{
    /**
     * Handle an incoming Lambda event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaResponse
     */
    public function handle(array $event)
    {
        usleep(50 * 1000);

        return new ArrayLambdaResponse([
            'output' => 'Warmer ping handled.',
        ]);
    }
}


================================================
FILE: src/Runtime/Http/Middleware/EnsureBinaryEncoding.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Http\Middleware;

use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\Response;

class EnsureBinaryEncoding
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  callable  $next
     * @return mixed
     */
    public function handle($request, $next)
    {
        $response = $next($request);

        if (static::isBase64EncodingRequired($response)) {
            $response->headers->set('X-Vapor-Base64-Encode', 'True');
        }

        return $response;
    }

    /**
     * Determine if base64 encoding is required for the response.
     *
     * @param  \Illuminate\Http\Response  $response
     * @return bool
     */
    public static function isBase64EncodingRequired(Response $response): bool
    {
        $contentType = strtolower($response->headers->get('Content-Type', 'text/html'));

        if (Str::startsWith($contentType, 'text/') ||
            Str::contains($contentType, ['xml', 'json'])) {
            return false;
        }

        return true;
    }
}


================================================
FILE: src/Runtime/Http/Middleware/EnsureOnNakedDomain.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Http\Middleware;

use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Str;

class EnsureOnNakedDomain
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  callable  $next
     * @return mixed
     */
    public function handle($request, $next)
    {
        if ('https://'.$request->getHttpHost() === $_ENV['APP_VANITY_URL']) {
            return $next($request);
        }

        if (config('vapor.redirect_to_root') === true &&
            strpos($request->getHost(), 'www.') === 0) {
            return new RedirectResponse(Str::replaceFirst(
                'www.', '', $request->fullUrl()
            ), 301);
        }

        if (config('vapor.redirect_to_root') === false) {
            $url = parse_url(config('app.url'));

            $nakedHost = preg_replace('#^www\.(.+\.)#i', '$1', $url[
                'host'
            ]);

            if ($request->getHost() === $nakedHost) {
                return new RedirectResponse(str_replace(
                    $request->getScheme().'://',
                    $request->getScheme().'://www.',
                    $request->fullUrl()
                ), 301);
            }
        }

        return $next($request);
    }
}


================================================
FILE: src/Runtime/Http/Middleware/EnsureVanityUrlIsNotIndexed.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Http\Middleware;

class EnsureVanityUrlIsNotIndexed
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  callable  $next
     * @return mixed
     */
    public function handle($request, $next)
    {
        $response = $next($request);

        if ('https://'.$request->getHttpHost() === $_ENV['APP_VANITY_URL']) {
            $response->headers->set('X-Robots-Tag', 'noindex, nofollow', true);
        }

        return $response;
    }
}


================================================
FILE: src/Runtime/Http/Middleware/RedirectStaticAssets.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Http\Middleware;

use Illuminate\Http\RedirectResponse;

class RedirectStaticAssets
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  callable  $next
     * @return mixed
     */
    public function handle($request, $next)
    {
        if (config('vapor.redirect_favicon', true) && $request->path() === 'favicon.ico') {
            return new RedirectResponse($_ENV['ASSET_URL'].'/favicon.ico', 302, [
                'Cache-Control' => 'public, max-age=3600',
            ]);
        }

        if (config('vapor.redirect_robots_txt') && $request->path() === 'robots.txt') {
            return new RedirectResponse($_ENV['ASSET_URL'].'/robots.txt', 302, [
                'Cache-Control' => 'public, max-age=3600',
            ]);
        }

        return $next($request);
    }
}


================================================
FILE: src/Runtime/HttpKernel.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Illuminate\Contracts\Http\Kernel as HttpKernelContract;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Http\MaintenanceModeBypassCookie;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Facade;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureBinaryEncoding;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureOnNakedDomain;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureVanityUrlIsNotIndexed;
use Laravel\Vapor\Runtime\Http\Middleware\RedirectStaticAssets;
use Symfony\Component\HttpFoundation\Cookie;

class HttpKernel
{
    /**
     * The application instance.
     *
     * @var \Illuminate\Foundation\Application
     */
    protected $app;

    /**
     * Create a new HTTP kernel instance.
     *
     * @param  \Illuminate\Foundation\Application  $app
     * @return void
     */
    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    /**
     * Handle the incoming HTTP request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function handle(Request $request)
    {
        $this->app->useStoragePath(StorageDirectories::PATH);

        if (static::shouldSendMaintenanceModeResponse($request)) {
            if (
                isset($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']) &&
                $_ENV['VAPOR_MAINTENANCE_MODE_SECRET'] == $request->path()
            ) {
                $response = static::bypassResponse($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']);

                $this->app->terminate();
            } elseif (
                isset($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']) &&
                static::hasValidBypassCookie($request, $_ENV['VAPOR_MAINTENANCE_MODE_SECRET'])
            ) {
                $response = $this->sendRequest($request);
            } else {
                if ($request->wantsJson() && file_exists($_ENV['LAMBDA_TASK_ROOT'].'/503.json')) {
                    $response = JsonResponse::fromJsonString(
                        file_get_contents($_ENV['LAMBDA_TASK_ROOT'].'/503.json'),
                        503
                    );
                } else {
                    $response = new Response(
                        file_get_contents($_ENV['LAMBDA_TASK_ROOT'].'/503.html'),
                        503
                    );
                }

                $this->app->terminate();
            }
        } else {
            $response = $this->sendRequest($request);
        }

        return $response;
    }

    /**
     * Determine if a maintenance mode response should be sent.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return bool
     */
    public static function shouldSendMaintenanceModeResponse(Request $request)
    {
        return isset($_ENV['VAPOR_MAINTENANCE_MODE']) &&
            $_ENV['VAPOR_MAINTENANCE_MODE'] === 'true' &&
            'https://'.$request->getHttpHost() !== $_ENV['APP_VANITY_URL'];
    }

    /**
     * Determine if the incoming request has a maintenance mode bypass cookie.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $secret
     * @return bool
     */
    public static function hasValidBypassCookie($request, $secret)
    {
        return $request->cookie('laravel_maintenance') &&
            MaintenanceModeBypassCookie::isValid(
                $request->cookie('laravel_maintenance'),
                $secret
            );
    }

    /**
     * Redirect the user back to the root of the application with a maintenance mode bypass cookie.
     *
     * @param  string  $secret
     * @return \Illuminate\Http\RedirectResponse
     */
    public static function bypassResponse(string $secret)
    {
        $response = new RedirectResponse('/');

        $expiresAt = Carbon::now()->addHours(12);
        $path = isset($_ENV['VAPOR_MAINTENANCE_MODE_COOKIE_PATH']) ? $_ENV['VAPOR_MAINTENANCE_MODE_COOKIE_PATH'] : '/';
        $domain = isset($_ENV['VAPOR_MAINTENANCE_MODE_COOKIE_DOMAIN']) ? $_ENV['VAPOR_MAINTENANCE_MODE_COOKIE_DOMAIN'] : null;

        $cookie = new Cookie('laravel_maintenance', base64_encode(json_encode([
            'expires_at' => $expiresAt->getTimestamp(),
            'mac' => hash_hmac('sha256', $expiresAt->getTimestamp(), $secret),
        ])), $expiresAt, $path, $domain);

        $response->headers->setCookie($cookie);

        return $response;
    }

    /**
     * Resolve the HTTP kernel for the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Contracts\Http\Kernel
     */
    protected function resolveKernel(Request $request)
    {
        return tap($this->app->make(HttpKernelContract::class), function ($kernel) use ($request) {
            $this->app->instance('request', $request);

            Facade::clearResolvedInstance('request');

            $kernel->bootstrap();
        });
    }

    /**
     * Send the request to the kernel.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    protected function sendRequest(Request $request)
    {
        $kernel = $this->resolveKernel($request);

        $response = (new Pipeline)->send($request)
            ->through([
                new EnsureOnNakedDomain,
                new RedirectStaticAssets,
                new EnsureVanityUrlIsNotIndexed,
                new EnsureBinaryEncoding(),
            ])->then(function ($request) use ($kernel) {
                return $kernel->handle($request);
            });

        $kernel->terminate($request, $response);

        return $response;
    }
}


================================================
FILE: src/Runtime/LambdaContainer.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Laravel\Vapor\Runtime\Octane\Octane;

class LambdaContainer
{
    /**
     * Terminate if the container has handled enough invocations.
     *
     * @param  int  $invocations
     * @param  int  $invocationLimit
     * @return void
     */
    public static function terminateIfInvocationLimitHasBeenReached($invocations, $invocationLimit)
    {
        if (empty($invocationLimit)) {
            return;
        }

        if ($invocations >= $invocationLimit) {
            if (interface_exists(\Laravel\Octane\Contracts\Client::class)) {
                Octane::terminate();
            }

            function_exists('__vapor_debug') && __vapor_debug('Killing container. Container has processed '.$invocationLimit.' invocations. ('.$_ENV['AWS_REQUEST_ID'].')');

            exit(0);
        }
    }
}


================================================
FILE: src/Runtime/LambdaInvocation.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Exception;

class LambdaInvocation
{
    /**
     * The cached curl handler.
     *
     * @var resource
     */
    protected static $handler;

    /**
     * Get the next Lambda invocation ID and body.
     *
     * @param  string  $apiUrl
     * @return array
     */
    public static function next($apiUrl)
    {
        if (is_null(static::$handler)) {
            static::$handler = curl_init("http://{$apiUrl}/2018-06-01/runtime/invocation/next");

            curl_setopt(static::$handler, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt(static::$handler, CURLOPT_FAILONERROR, true);
        }

        // Retrieve the Lambda invocation ID...
        $invocationId = '';

        curl_setopt(static::$handler, CURLOPT_HEADERFUNCTION, function ($ch, $header) use (&$invocationId) {
            if (! preg_match('/:\s*/', $header)) {
                return strlen($header);
            }

            [$name, $value] = preg_split('/:\s*/', $header, 2);

            if (strtolower($name) === 'lambda-runtime-aws-request-id') {
                $invocationId = trim($value);
            }

            return strlen($header);
        });

        // Retrieve the Lambda invocation event body...
        $body = '';

        curl_setopt(static::$handler, CURLOPT_WRITEFUNCTION, function ($ch, $chunk) use (&$body) {
            $body .= $chunk;

            return strlen($chunk);
        });

        curl_exec(static::$handler);

        static::ensureNoErrorsOccurred(
            $invocationId, $body
        );

        return [$invocationId, json_decode($body, true)];
    }

    /**
     * Ensure no errors occurred retrieving the invocation.
     *
     * @param  string  $invocationId
     * @param  string  $body
     * @return void
     */
    protected static function ensureNoErrorsOccurred($invocationId, $body)
    {
        if (curl_error(static::$handler)) {
            throw new Exception('Failed to retrieve the next Lambda invocation: '.curl_error(static::$handler));
        }

        if ($invocationId === '') {
            throw new Exception('Failed to parse the Lambda invocation ID.');
        }

        if ($body === '') {
            throw new Exception('The Lambda runtime API returned an empty response.');
        }
    }
}


================================================
FILE: src/Runtime/LambdaResponse.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Laravel\Vapor\Contracts\LambdaResponse as LambdaResponseContract;
use stdClass;

class LambdaResponse implements LambdaResponseContract
{
    /**
     * The response status code.
     *
     * @var int
     */
    protected $status = 200;

    /**
     * The response headers.
     *
     * @var array
     */
    protected $headers;

    /**
     * The response body.
     *
     * @var string
     */
    protected $body;

    /**
     * Create a new Lambda response from an FPM response.
     *
     * @param  int  $status
     * @param  array  $headers
     * @param  string  $body
     * @return void
     */
    public function __construct(int $status, array $headers, $body)
    {
        $this->body = $body;
        $this->status = $status;
        $this->headers = $headers;
    }

    /**
     * Convert the response to API Gateway's supported format.
     *
     * @return array
     */
    public function toApiGatewayFormat()
    {
        $requiresEncoding = isset($this->headers['x-vapor-base64-encode'][0]);

        return [
            'isBase64Encoded' => $requiresEncoding,
            'statusCode' => $this->status,
            'headers' => empty($this->headers) ? new stdClass : $this->prepareHeaders($this->headers),
            'body' => $requiresEncoding ? base64_encode($this->body) : $this->body,
        ];
    }

    /**
     * Prepare the given response headers for API Gateway.
     *
     * @param  array  $responseHeaders
     * @return array
     */
    protected function prepareHeaders(array $responseHeaders)
    {
        $headers = [];

        foreach ($responseHeaders as $name => $values) {
            $name = $this->normalizeHeaderName($name);

            if ($name == 'Set-Cookie') {
                $headers = array_merge($headers, $this->buildCookieHeaders($values));

                continue;
            }

            foreach ($values as $value) {
                $headers[$name] = $value;
            }
        }

        if (! isset($headers['Content-Type'])) {
            $headers['Content-Type'] = 'text/html';
        }

        return $headers;
    }

    /**
     * Build the Set-Cookie header names using binary casing.
     *
     * @param  array  $values
     * @return array
     */
    protected function buildCookieHeaders(array $values)
    {
        $headers = [];

        foreach ($values as $index => $value) {
            $headers[$this->cookiePermutation($index)] = $value;
        }

        return $headers;
    }

    /**
     * Calculate the permutation of Set-Cookie for the current index.
     *
     * @param  int  $index
     * @return string
     */
    protected function cookiePermutation($index)
    {
        // Hard-coded to support up to 18 cookies for now...
        switch ($index) {
            case 0:
                return 'set-cookie';
            case 1:
                return 'Set-cookie';
            case 2:
                return 'sEt-cookie';
            case 3:
                return 'seT-cookie';
            case 4:
                return 'set-Cookie';
            case 5:
                return 'set-cOokie';
            case 6:
                return 'set-coOkie';
            case 7:
                return 'set-cooKie';
            case 8:
                return 'set-cookIe';
            case 9:
                return 'set-cookiE';
            case 10:
                return 'SEt-cookie';
            case 11:
                return 'SET-cookie';
            case 12:
                return 'SEt-Cookie';
            case 13:
                return 'SEt-cOokie';
            case 14:
                return 'SEt-coOkie';
            case 15:
                return 'SEt-cooKie';
            case 16:
                return 'SEt-cookIe';
            case 17:
                return 'SEt-cookiE';
            default:
                return 'Set-Cookie';
        }
    }

    /**
     * Normalize the given header name into studly-case.
     *
     * @param  string  $name
     * @return string
     */
    protected function normalizeHeaderName($name)
    {
        return str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
    }
}


================================================
FILE: src/Runtime/LambdaRuntime.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Exception;
use Throwable;

class LambdaRuntime
{
    use NotifiesLambda;

    /**
     * The Lambda API URL.
     *
     * @var string
     */
    protected $apiUrl;

    /**
     * Create a new Lambda runtime.
     *
     * @param  string  $apiUrl
     * @return void
     */
    public function __construct($apiUrl)
    {
        $this->apiUrl = $apiUrl;
    }

    /**
     * Create new Lambda runtime from the API environment variable.
     *
     * @return static
     */
    public static function fromEnvironmentVariable()
    {
        return new static(getenv('AWS_LAMBDA_RUNTIME_API'));
    }

    /**
     * Handle the next Lambda invocation.
     *
     * @return void
     */
    public function nextInvocation(callable $callback)
    {
        [$invocationId, $event] = LambdaInvocation::next($this->apiUrl);

        $_ENV['AWS_REQUEST_ID'] = $invocationId;

        try {
            $this->notifyLambdaOfResponse($invocationId, $callback($invocationId, $event));
        } catch (Throwable $error) {
            $this->handleException($invocationId, $error);

            exit(1);
        }
    }

    /**
     * Inform Lambda of an invocation failure.
     *
     * @return void
     */
    public function handleException(string $invocationId, Throwable $error)
    {
        $errorMessage = $error instanceof Exception
                    ? 'Uncaught '.get_class($error).': '.$error->getMessage()
                    : $error->getMessage();

        function_exists('__vapor_debug') && __vapor_debug(sprintf(
            "Fatal error: %s in %s:%d\nStack trace:\n%s",
            $errorMessage,
            $error->getFile(),
            $error->getLine(),
            $error->getTraceAsString()
        ));

        $this->notifyLambdaOfError($invocationId, [
            'errorMessage' => $error->getMessage(),
            'errorType' => get_class($error),
            'stackTrace' => explode(PHP_EOL, $error->getTraceAsString()),
        ]);
    }
}


================================================
FILE: src/Runtime/LoadBalancedLambdaResponse.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Symfony\Component\HttpFoundation\Response as SymfonyResponse;

class LoadBalancedLambdaResponse extends LambdaResponse
{
    /**
     * Convert the response to Load Balancer's supported format.
     *
     * @return array
     */
    public function toApiGatewayFormat()
    {
        $requiresEncoding = isset($this->headers['x-vapor-base64-encode'][0]);

        return [
            'isBase64Encoded' => $requiresEncoding,
            'statusCode' => $this->status,
            'statusDescription' => $this->status.' '.$this->statusText($this->status),
            'multiValueHeaders' => empty($this->headers) ? [] : $this->prepareHeaders($this->headers),
            'body' => $requiresEncoding ? base64_encode($this->body) : $this->body,
        ];
    }

    /**
     * Get the status text for the given status code.
     *
     * @param  int  $status
     * @return string
     */
    public function statusText($status)
    {
        $statusTexts = SymfonyResponse::$statusTexts;

        $statusTexts[419] = 'Authentication Timeout';

        return $statusTexts[$status];
    }

    /**
     * Prepare the given response headers.
     *
     * @param  array  $responseHeaders
     * @return array
     */
    protected function prepareHeaders(array $responseHeaders)
    {
        $headers = [];

        foreach ($responseHeaders as $name => $values) {
            $headers[static::normalizeHeaderName($name)] = static::normalizeHeaderValues($values);
        }

        if (! isset($headers['Content-Type']) || empty($headers['Content-Type'])) {
            $headers['Content-Type'] = ['text/html'];
        }

        return $headers;
    }

    /**
     * Normalize the given header values into strings.
     *
     * @param  array  $values
     * @return array
     */
    protected function normalizeHeaderValues($values)
    {
        return array_map(function ($value) {
            return (string) $value;
        }, $values);
    }
}


================================================
FILE: src/Runtime/Logger.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Monolog\Formatter\JsonFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger as MonologLogger;

class Logger
{
    /**
     * The logger instance.
     *
     * @var \Monolog\Logger
     */
    protected static $logger;

    /**
     * Write general information to the log.
     *
     * @param  string  $message
     * @param  array  $context
     * @return void
     */
    public static function info($message, array $context = [])
    {
        static::ensureLoggerIsAvailable();

        static::$logger->info($message, $context);
    }

    /**
     * Write error information to the log.
     *
     * @param  string  $message
     * @param  array  $context
     * @return void
     */
    public static function error($message, array $context = [])
    {
        static::ensureLoggerIsAvailable();

        static::$logger->error($message, $context);
    }

    /**
     * Ensure the logger has been instantiated.
     *
     * @return void
     */
    protected static function ensureLoggerIsAvailable()
    {
        if (isset(static::$logger)) {
            return;
        }

        static::$logger = new MonologLogger('vapor', [
            (new StreamHandler('php://stderr'))->setFormatter(new JsonFormatter),
        ]);
    }
}


================================================
FILE: src/Runtime/NotifiesLambda.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Exception;

trait NotifiesLambda
{
    /**
     * Send the response data to Lambda.
     *
     * @param  string  $invocationId
     * @param  mixed  $data
     * @return void
     */
    protected function notifyLambdaOfResponse($invocationId, $data)
    {
        return $this->lambdaRequest(
            "http://{$this->apiUrl}/2018-06-01/runtime/invocation/{$invocationId}/response", $data
        );
    }

    /**
     * Send the error response data to Lambda.
     *
     * @param  string  $invocationId
     * @param  mixed  $data
     * @return void
     */
    protected function notifyLambdaOfError($invocationId, $data)
    {
        return $this->lambdaRequest(
            "http://{$this->apiUrl}/2018-06-01/runtime/invocation/{$invocationId}/error", $data
        );
    }

    /**
     * Send the given data to the given URL as JSON.
     *
     * @param  string  $url
     * @param  mixed  $data
     * @return void
     */
    protected function lambdaRequest($url, $data)
    {
        $json = json_encode($data);

        if ($json === false) {
            throw new Exception('Error encoding runtime JSON response: '.json_last_error_msg());
        }

        $handler = curl_init($url);

        curl_setopt($handler, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handler, CURLOPT_POSTFIELDS, $json);

        curl_setopt($handler, CURLOPT_HTTPHEADER, [
            'Content-Type: application/json',
            'Content-Length: '.strlen($json),
        ]);

        curl_exec($handler);

        if (curl_error($handler)) {
            $errorMessage = curl_error($handler);

            throw new Exception('Error calling the runtime API: '.$errorMessage);
        }

        curl_setopt($handler, CURLOPT_HEADERFUNCTION, null);
        curl_setopt($handler, CURLOPT_READFUNCTION, null);
        curl_setopt($handler, CURLOPT_WRITEFUNCTION, null);
        curl_setopt($handler, CURLOPT_PROGRESSFUNCTION, null);

        curl_reset($handler);

        if (PHP_VERSION_ID >= 80000) {
            unset($handler);
        } else {
            curl_close($handler);
        }
    }
}


================================================
FILE: src/Runtime/Octane/Octane.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Octane;

use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Database\MySqlConnection;
use Illuminate\Foundation\Application;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pipeline\Pipeline;
use Laravel\Octane\ApplicationFactory;
use Laravel\Octane\Contracts\Client;
use Laravel\Octane\MarshalsPsr7RequestsAndResponses;
use Laravel\Octane\OctaneResponse;
use Laravel\Octane\RequestContext;
use Laravel\Octane\Worker;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureBinaryEncoding;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureOnNakedDomain;
use Laravel\Vapor\Runtime\Http\Middleware\EnsureVanityUrlIsNotIndexed;
use Laravel\Vapor\Runtime\Http\Middleware\RedirectStaticAssets;
use Laravel\Vapor\Runtime\HttpKernel;
use Laravel\Vapor\Runtime\Response;
use Laravel\Vapor\Runtime\StorageDirectories;
use PDO;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Throwable;

class Octane implements Client
{
    use MarshalsPsr7RequestsAndResponses;

    /**
     * The default database session time-to-live.
     */
    const DB_SESSION_DEFAULT_TTL = 28800;

    /**
     * List of Octane database sessions.
     *
     * @var bool
     */
    protected static $databaseSessions = [
        // ..
    ];

    /**
     * The Octane response, if any.
     *
     * @var \Laravel\Octane\OctaneResponse|null
     */
    protected static $response;

    /**
     * The Octane worker, if any.
     *
     * @var \Laravel\Octane\Worker|null
     */
    protected static $worker;

    /**
     * Boots an Octane worker instance.
     *
     * @param  string  $basePath
     * @param  bool  $databaseSessionPersist
     * @param  int  $databaseSessionTtl
     * @return void
     */
    public static function boot($basePath, $databaseSessionPersist = false, $databaseSessionTtl = 0)
    {
        self::ensureServerSoftware('vapor');

        $databaseSessionTtl = (int) $databaseSessionTtl;

        static::$worker = tap(new Worker(
            new ApplicationFactory($basePath), new self)
        )->boot()->onRequestHandled(static::manageDatabaseSessions($databaseSessionPersist, $databaseSessionTtl));

        if ($databaseSessionPersist && $databaseSessionTtl > 0) {
            static::worker()->application()->make('db')->beforeExecuting(function ($query, $bindings, $connection) {
                if ($connection instanceof MySqlConnection && ! in_array($connection->getName(), static::$databaseSessions)) {
                    static::$databaseSessions[] = $connection->getName();

                    $connection->unprepared(sprintf(
                        'SET SESSION wait_timeout=%s', static::DB_SESSION_DEFAULT_TTL
                    ));
                }
            });
        }
    }

    /**
     * Manage the database sessions.
     *
     * @param  bool  $databaseSessionPersist
     * @param  int  $databaseSessionTtl
     * @return callable
     */
    protected static function manageDatabaseSessions($databaseSessionPersist, $databaseSessionTtl)
    {
        return function ($request, $response, $sandbox) use ($databaseSessionPersist, $databaseSessionTtl) {
            if (! $sandbox->resolved('db') || ($databaseSessionPersist && $databaseSessionTtl == 0)) {
                return;
            }

            $connections = collect($sandbox->make('db')->getConnections());

            if (! $databaseSessionPersist) {
                return $connections->each->disconnect();
            }

            $connections->filter(function ($connection) {
                $hasSession = in_array($connection->getName(), static::$databaseSessions);

                if (! $hasSession) {
                    try {
                        $connection->disconnect();
                    } catch (Throwable $e) {
                        // Likely already disconnected...
                    }
                }

                return $hasSession;
            })->map->getRawPdo()->filter(function ($pdo) {
                return $pdo instanceof PDO;
            })->each(function ($pdo) use ($databaseSessionTtl) {
                try {
                    $pdo->exec(sprintf(
                        'SET SESSION wait_timeout=%s', $databaseSessionTtl
                    ));
                } catch (Throwable $e) {
                    // Connection already gone away, safe to ignore...
                }
            });
        };
    }

    /**
     * Handle the given Octane request.
     *
     * @param  \Laravel\Octane\RequestContext  $request
     * @return \Laravel\Vapor\Runtime\Response
     */
    public static function handle($request)
    {
        [$request, $context] = (new self)->marshalRequest($request);

        static::$databaseSessions = [];

        self::worker()->application()->useStoragePath(StorageDirectories::PATH);

        if (HttpKernel::shouldSendMaintenanceModeResponse($request)) {
            if (isset($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']) &&
                $_ENV['VAPOR_MAINTENANCE_MODE_SECRET'] == $request->path()) {
                $response = HttpKernel::bypassResponse($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']);
            } elseif (isset($_ENV['VAPOR_MAINTENANCE_MODE_SECRET']) &&
                static::hasValidBypassCookie($request, $_ENV['VAPOR_MAINTENANCE_MODE_SECRET'])) {
                $response = static::sendRequest($request, $context);
            } elseif ($request->wantsJson() && file_exists($_ENV['LAMBDA_TASK_ROOT'].'/503.json')) {
                $response = JsonResponse::fromJsonString(
                    file_get_contents($_ENV['LAMBDA_TASK_ROOT'].'/503.json'), 503
                );
            } else {
                $response = new \Illuminate\Http\Response(
                    file_get_contents($_ENV['LAMBDA_TASK_ROOT'].'/503.html'), 503
                );
            }
        } else {
            $response = static::sendRequest($request, $context);
        }

        $content = $response instanceof BinaryFileResponse
            ? $response->getFile()->getContent()
            : $response->getContent();

        if ($response instanceof StreamedResponse) {
            $content = static::captureContent($response);
        }

        return tap(new Response(
            $content,
            $response->headers->all(),
            $response->getStatusCode()
        ), static function () {
            static::$response = null;
        });
    }

    /**
     * Send the request to the worker.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Laravel\Octane\RequestContext  $context
     * @return \Laravel\Octane\OctaneResponse
     */
    protected static function sendRequest($request, $context)
    {
        return (new Pipeline)->send($request)
            ->through([
                new EnsureOnNakedDomain,
                new RedirectStaticAssets,
                new EnsureVanityUrlIsNotIndexed,
                new EnsureBinaryEncoding(),
            ])->then(function ($request) use ($context) {
                static::$worker->handle($request, $context);

                return static::$response->response;
            });
    }

    /**
     * Determine if the incoming request has a maintenance mode bypass cookie.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $secret
     * @return bool
     */
    public static function hasValidBypassCookie($request, $secret)
    {
        return HttpKernel::hasValidBypassCookie($request, $secret);
    }

    /**
     * Terminates an Octane worker instance, if any.
     *
     * @return void
     */
    public static function terminate()
    {
        if (static::$worker) {
            static::$worker->terminate();

            static::$worker = null;

            self::ensureServerSoftware(null);
        }
    }

    /**
     * Marshal the given Octane request context into an Laravel foundation request.
     */
    public function marshalRequest(RequestContext $context): array
    {
        return [
            static::toHttpFoundationRequest($context->psr7Request),
            $context,
        ];
    }

    /**
     * Stores the response in the instance.
     */
    public function respond(RequestContext $context, OctaneResponse $response): void
    {
        static::$response = $response;
    }

    /**
     * Send an error message to the server.
     */
    public function error(Throwable $e, Application $app, Request $request, RequestContext $context): void
    {
        try {
            static::$response = new OctaneResponse(
                $app[ExceptionHandler::class]->render($request, $e)
            );
        } catch (Throwable $throwable) {
            function_exists('__vapor_debug') && __vapor_debug($throwable->getMessage());
            function_exists('__vapor_debug') && __vapor_debug($e->getMessage());

            static::$response = new OctaneResponse(
                new \Illuminate\Http\Response('', 500)
            );
        }
    }

    /**
     * Ensures the given software name is set globally.
     *
     * @param  string|null  $software
     * @return void
     */
    protected static function ensureServerSoftware($software)
    {
        $_ENV['SERVER_SOFTWARE'] = $software;
        $_SERVER['SERVER_SOFTWARE'] = $software;
    }

    /**
     * Get the Octane worker, if any.
     *
     * @return \Laravel\Octane\Worker|null
     */
    public static function worker()
    {
        return static::$worker;
    }

    /**
     * Capture the content from a streamed response.
     */
    protected static function captureContent(StreamedResponse $response): string
    {
        ob_start();
        $response->sendContent();
        $content = ob_get_contents();
        ob_end_clean();

        return $content;
    }
}


================================================
FILE: src/Runtime/Octane/OctaneHttpHandlerFactory.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Octane;

use Laravel\Vapor\Runtime\Handlers\LoadBalancedOctaneHandler;
use Laravel\Vapor\Runtime\Handlers\OctaneHandler;
use Laravel\Vapor\Runtime\Handlers\PayloadFormatVersion2OctaneHandler;
use Laravel\Vapor\Runtime\Handlers\UnknownEventHandler;
use Laravel\Vapor\Runtime\Handlers\WarmerHandler;
use Laravel\Vapor\Runtime\Handlers\WarmerPingHandler;

class OctaneHttpHandlerFactory
{
    /**
     * Create a new handler for the given HTTP event.
     *
     * @param  array  $event
     * @return \Laravel\Vapor\Contracts\LambdaEventHandler
     */
    public static function make(array $event)
    {
        if (isset($event['vaporWarmer'])) {
            return new WarmerHandler;
        } elseif (isset($event['vaporWarmerPing'])) {
            return new WarmerPingHandler;
        } elseif (isset($event['requestContext']['elb'])) {
            return new LoadBalancedOctaneHandler;
        } elseif (isset($event['version']) && $event['version'] === '2.0') {
            return new PayloadFormatVersion2OctaneHandler;
        } elseif (isset($event['httpMethod']) || isset($event['requestContext']['http']['method'])) {
            return new OctaneHandler;
        }

        return new UnknownEventHandler;
    }
}


================================================
FILE: src/Runtime/Octane/OctaneRequestContextFactory.php
================================================
<?php

namespace Laravel\Vapor\Runtime\Octane;

use Illuminate\Support\Arr as SupportArr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Laravel\Octane\RequestContext;
use Laravel\Vapor\Arr;
use Laravel\Vapor\Runtime\Request;
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\UploadedFile;
use Riverline\MultiPartParser\Part;

class OctaneRequestContextFactory
{
    /**
     * Creates an Octane request context from the given event.
     *
     * @param  array  $event
     * @param  array  $serverVariables
     * @return \Laravel\Octane\RequestContext
     */
    public static function fromEvent($event, $serverVariables)
    {
        $request = Request::fromLambdaEvent($event, $serverVariables);

        $method = $request->serverVariables['REQUEST_METHOD'];

        $contentType = array_change_key_case($request->headers)['content-type'] ?? null;

        $serverRequest = new ServerRequest(
            $request->serverVariables['REQUEST_METHOD'],
            static::parseUri($request->serverVariables['REQUEST_URI']),
            $request->headers,
            $request->body,
            $request->serverVariables['SERVER_PROTOCOL'],
            $request->serverVariables
        );

        $serverRequest = $serverRequest->withCookieParams(static::cookies($event, $request->headers));

        $serverRequest = $serverRequest->withUploadedFiles(static::uploadedFiles(
            $method, $contentType, $request->body
        ));

        $serverRequest = $serverRequest->withParsedBody(static::parsedBody(
            $method, $contentType, $request->body
        ));

        parse_str($request->serverVariables['QUERY_STRING'], $queryParams);

        $serverRequest = $serverRequest->withQueryParams($queryParams);

        return new RequestContext([
            'psr7Request' => $serverRequest,
        ]);
    }

    /**
     * Get the cookies from the given headers.
     *
     * @param  array  $event
     * @param  array  $headers
     * @return array
     */
    protected static function cookies($event, $headers)
    {
        if (isset($event['version']) && $event['version'] === '2.0') {
            $cookies = $event['cookies'] ?? [];
        } else {
            $headers = array_change_key_case($headers);

            $cookies = isset($headers['cookie']) ? explode('; ', $headers['cookie']) : [];
        }

        if (empty($cookies)) {
            return [];
        }

        return Collection::make($cookies)->mapWithKeys(function ($cookie) {
            $cookie = explode('=', trim($cookie), 2);

            $key = $cookie[0];

            if (! isset($cookie[1])) {
                return [$key => null];
            }

            return [$key => urldecode($cookie[1])];
        })->filter()->all();
    }

    /**
     * Create a new file instance from the given HTTP request document part.
     *
     * @param  \Riverline\MultipartParser\Part  $part
     * @return \Psr\Http\Message\UploadedFileInterface
     */
    protected static function createFile($part)
    {
        file_put_contents(
            $path = tempnam(sys_get_temp_dir(), 'vapor_upload_'),
            $part->getBody()
        );

        return new UploadedFile(
            $path,
            filesize($path),
            UPLOAD_ERR_OK,
            $part->getFileName(),
            $part->getMimeType()
        );
    }

    /**
     * Parse the files for the given HTTP request body.
     *
     * @param  string  $contentType
     * @param  string  $body
     * @return array
     */
    protected static function parseFiles($contentType, $body)
    {
        $document = new Part("Content-Type: $contentType\r\n\r\n".$body);

        if (! $document->isMultiPart()) {
            return [];
        }

        return Collection::make($document->getParts())
            ->filter
            ->isFile()
            ->reduce(function ($files, $part) {
                return Str::contains($name = $part->getName(), '[')
                    ? Arr::setMultiPartArrayValue($files, $name, static::createFile($part))
                    : SupportArr::set($files, $name, static::createFile($part));
            }, []);
    }

    /**
     * Get the uploaded files for the incoming event.
     *
     * @param  string  $method
     * @param  string  $contentType
     * @param  string  $body
     * @return array
     */
    protected static function uploadedFiles($method, $contentType, $body)
    {
        if (! in_array($method, ['POST', 'PUT']) ||
            is_null($contentType) ||
            static::isUrlEncodedForm($contentType)) {
            return [];
        }

        return static::parseFiles($contentType, $body);
    }

    /**
     * Get the parsed body for the event.
     *
     * @param  string  $method
     * @param  string  $contentType
     * @param  string  $body
     * @return array|null
     */
    protected static function parsedBody($method, $contentType, $body)
    {
        if (! in_array($method, ['POST', 'PUT']) || is_null($contentType)) {
            return;
        }

        if (static::isUrlEncodedForm($contentType)) {
            parse_str($body, $parsedBody);

            return $parsedBody;
        }

        return static::parseBody($contentType, $body);
    }

    /**
     * Parse the incoming event's request body.
     *
     * @param  string  $contentType
     * @param  string  $body
     * @return array
     */
    protected static function parseBody($contentType, $body)
    {
        $document = new Part("Content-Type: $contentType\r\n\r\n".$body);

        if (! $document->isMultiPart()) {
            return;
        }

        return Collection::make($document->getParts())
            ->reject
            ->isFile()
            ->reduce(function ($parsedBody, $part) {
                return Str::contains($name = $part->getName(), '[')
                    ? Arr::setMultiPartArrayValue($parsedBody, $name, $part->getBody())
                    : SupportArr::set($parsedBody, $name, $part->getBody());
            }, []);
    }

    /**
     * Parse the incoming event's request uri.
     *
     * @param  string  $uri
     * @return string
     */
    protected static function parseUri($uri)
    {
        if (parse_url($uri) === false) {
            return '/';
        }

        return $uri;
    }

    /**
     * Determine if the given content type represents a URL encoded form.
     *
     * @param  string  $contentType
     * @return bool
     */
    protected static function isUrlEncodedForm($contentType)
    {
        return Str::contains(strtolower($contentType), 'application/x-www-form-urlencoded');
    }
}


================================================
FILE: src/Runtime/PayloadFormatVersion2LambdaResponse.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Laravel\Vapor\Contracts\LambdaResponse as LambdaResponseContract;
use stdClass;

class PayloadFormatVersion2LambdaResponse extends LambdaResponse implements LambdaResponseContract
{
    /**
     * Convert the response to API Gateway's supported format.
     *
     * @return array
     */
    public function toApiGatewayFormat()
    {
        $requiresEncoding = isset($this->headers['x-vapor-base64-encode'][0]);

        return [
            'isBase64Encoded' => $requiresEncoding,
            'statusCode' => $this->status,
            'cookies' => isset($this->headers['set-cookie']) ? $this->headers['set-cookie'] : [],
            'headers' => empty($this->headers) ? new stdClass : $this->prepareHeaders($this->headers),
            'body' => $requiresEncoding ? base64_encode($this->body) : $this->body,
        ];
    }

    /**
     * Prepare the given response headers for API Gateway.
     *
     * @param  array  $responseHeaders
     * @return array
     */
    protected function prepareHeaders(array $responseHeaders)
    {
        $headers = [];

        foreach ($responseHeaders as $name => $values) {
            $name = $this->normalizeHeaderName($name);

            if ($name == 'Set-Cookie') {
                continue;
            }

            foreach ($values as $value) {
                $headers[$name] = $value;
            }
        }

        if (! isset($headers['Content-Type'])) {
            $headers['Content-Type'] = 'text/html';
        }

        return $headers;
    }
}


================================================
FILE: src/Runtime/Request.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Illuminate\Support\Arr;

class Request
{
    /**
     * The request server variables.
     *
     * @var array
     */
    public $serverVariables;

    /**
     * The request body.
     *
     * @var string
     */
    public $body;

    /**
     * The request headers.
     *
     * @var array
     */
    public $headers;

    /**
     * Create a new request instance.
     *
     * @param  array  $serverVariables
     * @param  string  $body
     * @param  array  $headers
     * @return void
     */
    public function __construct(array $serverVariables, $body, $headers)
    {
        $this->body = $body;
        $this->serverVariables = $serverVariables;
        $this->headers = $headers;
    }

    /**
     * Create a new request from the given Lambda event.
     *
     * @param  array  $event
     * @param  array  $serverVariables
     * @param  string|null  $handler
     * @return static
     */
    public static function fromLambdaEvent(array $event, array $serverVariables = [], $handler = null)
    {
        [$uri, $queryString] = static::getUriAndQueryString($event);

        $headers = static::getHeaders($event);

        $requestBody = static::getRequestBody($event);

        $serverVariables = array_merge($serverVariables, [
            'GATEWAY_INTERFACE' => 'FastCGI/1.0',
            'PATH_INFO' => $event['path'] ?? $event['requestContext']['http']['path'] ?? '/',
            'QUERY_STRING' => $queryString,
            'REMOTE_ADDR' => '127.0.0.1',
            'REMOTE_PORT' => $headers['x-forwarded-port'] ?? 80,
            'REQUEST_METHOD' => $event['httpMethod'] ?? $event['requestContext']['http']['method'],
            'REQUEST_URI' => $uri,
            'REQUEST_TIME' => time(),
            'REQUEST_TIME_FLOAT' => microtime(true),
            'SERVER_ADDR' => '127.0.0.1',
            'SERVER_NAME' => $headers['host'] ?? 'localhost',
            'SERVER_PORT' => $headers['x-forwarded-port'] ?? 80,
            'SERVER_PROTOCOL' => $event['requestContext']['protocol'] ?? $event['requestContext']['http']['protocol'] ?? 'HTTP/1.1',
            'SERVER_SOFTWARE' => 'vapor',
        ]);

        if ($handler) {
            $serverVariables['SCRIPT_FILENAME'] = $handler;
        }

        if ($timestamp = self::extractRequestTimestamp($event)) {
            $serverVariables['AWS_API_GATEWAY_REQUEST_TIME'] = $timestamp;
        }

        [$headers, $serverVariables] = static::ensureContentTypeIsSet(
            $event, $headers, $serverVariables
        );

        [$headers, $serverVariables] = static::ensureContentLengthIsSet(
            $event, $headers, $serverVariables, $requestBody
        );

        $headers = static::ensureSourceIpAddressIsSet(
            $event, $headers
        );

        foreach ($headers as $header => $value) {
            $serverVariables['HTTP_'.strtoupper(str_replace('-', '_', $header))] = $value;
        }

        return new static($serverVariables, $requestBody, $headers);
    }

    /**
     * Get the URI and query string for the given event.
     *
     * @param  array  $event
     * @return array
     */
    protected static function getUriAndQueryString(array $event)
    {
        $uri = $event['requestContext']['http']['path'] ?? $event['path'] ?? '/';

        $queryString = self::getQueryString($event);

        parse_str($queryString, $queryParameters);

        return [
            empty($queryString) ? $uri : $uri.'?'.$queryString,
            http_build_query($queryParameters),
        ];
    }

    /**
     * Get the query string from the event.
     *
     * @param  array  $event
     * @return string
     */
    protected static function getQueryString(array $event)
    {
        if (isset($event['version']) && $event['version'] === '2.0') {
            return http_build_query(
                collect($event['queryStringParameters'] ?? [])
                ->mapWithKeys(function ($value, $key) {
                    $values = explode(',', $value);

                    return count($values) === 1
                        ? [$key => $values[0]]
                        : [(substr($key, -2) == '[]' ? substr($key, 0, -2) : $key) => $values];
                })->all()
            );
        }

        if (! isset($event['multiValueQueryStringParameters'])) {
            return http_build_query(
                $event['queryStringParameters'] ?? []
            );
        }

        return http_build_query(
            collect($event['multiValueQueryStringParameters'] ?? [])
                ->mapWithKeys(function ($values, $key) use ($event) {
                    $key = ! isset($event['requestContext']['elb']) ? $key : urldecode($key);

                    return count($values) === 1
                        ? [$key => $values[0]]
                        : [(substr($key, -2) == '[]' ? substr($key, 0, -2) : $key) => $values];
                })->map(function ($values) use ($event) {
                    if (! isset($event['requestContext']['elb'])) {
                        return $values;
                    }

                    return ! is_array($values) ? urldecode($values) : array_map(function ($value) {
                        return urldecode($value);
                    }, $values);
                })->all()
        );
    }

    /**
     * Get the request headers from the event.
     *
     * @param  array  $event
     * @return array
     */
    protected static function getHeaders(array $event)
    {
        if (! isset($event['multiValueHeaders'])) {
            return array_change_key_case(
                $event['headers'] ?? [], CASE_LOWER
            );
        }

        return array_change_key_case(
            collect($event['multiValueHeaders'] ?? [])
                ->mapWithKeys(function ($headers, $name) {
                    return [$name => Arr::last($headers)];
                })->all(), CASE_LOWER
        );
    }

    /**
     * Get the request body from the event.
     *
     * @param  array  $event
     * @return string
     */
    protected static function getRequestBody(array $event)
    {
        $body = $event['body'] ?? '';

        return isset($event['isBase64Encoded']) && $event['isBase64Encoded']
            ? base64_decode($body)
            : $body;
    }

    /**
     * Ensure the request headers / server variables contain a content type.
     *
     * @param  array  $event
     * @param  array  $headers
     * @param  array  $serverVariables
     * @return array
     */
    protected static function ensureContentTypeIsSet(array $event, array $headers, array $serverVariables)
    {
        if ((! isset($headers['content-type']) && isset($event['httpMethod']) && (strtoupper($event['httpMethod']) === 'POST')) ||
            (! isset($headers['content-type']) && isset($event['requestContext']['http']['method']) && (strtoupper($event['requestContext']['http']['method']) === 'POST'))) {
            $headers['content-type'] = 'application/x-www-form-urlencoded';
        }

        if (isset($headers['content-type'])) {
            $serverVariables['CONTENT_TYPE'] = $headers['content-type'];
        }

        return [$headers, $serverVariables];
    }

    /**
     * Ensure the request headers / server variables contain a content length.
     *
     * @param  array  $event
     * @param  array  $headers
     * @param  array  $serverVariables
     * @param  string  $requestBody
     * @return array
     */
    protected static function ensureContentLengthIsSet(array $event, array $headers, array $serverVariables, $requestBody)
    {
        if ((! isset($headers['content-length']) && isset($event['httpMethod']) && ! in_array(strtoupper($event['httpMethod']), ['TRACE'])) ||
            (! isset($headers['content-length']) && isset($event['requestContext']['http']['method']) && ! in_array(strtoupper($event['requestContext']['http']['method']), ['TRACE']))) {
            $headers['content-length'] = strlen($requestBody);
        }

        if (isset($headers['content-length'])) {
            $serverVariables['CONTENT_LENGTH'] = $headers['content-length'];
        }

        return [$headers, $serverVariables];
    }

    /**
     * Ensure the request headers contain a source IP address.
     *
     * @param  array  $event
     * @param  array  $headers
     * @return array
     */
    protected static function ensureSourceIpAddressIsSet(array $event, array $headers)
    {
        if (isset($event['requestContext']['identity']['sourceIp'])) {
            $headers['x-vapor-source-ip'] = $event['requestContext']['identity']['sourceIp'];
        }

        if (isset($event['requestContext']['http']['sourceIp'])) {
            $headers['x-vapor-source-ip'] = $event['requestContext']['http']['sourceIp'];
        }

        return $headers;
    }

    /**
     * Extracts the time (millisecond epoch) when the request was received by the API Gateway.
     *
     * @param  array  $event
     * @return int|null
     */
    protected static function extractRequestTimestamp(array $event)
    {
        if (! isset($event['requestContext'])) {
            return null;
        }

        return $event['requestContext']['requestTimeEpoch'] // REST API (V1)
            ?? $event['requestContext']['timeEpoch']        // HTTP API (V2)
            ?? null;
    }
}


================================================
FILE: src/Runtime/Response.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

class Response
{
    /**
     * The response status code.
     *
     * @var int
     */
    public $status;

    /**
     * The response headers.
     *
     * @var array
     */
    public $headers;

    /**
     * The response body.
     *
     * @var string
     */
    public $body;

    /**
     * Create a new response instance.
     *
     * @param  string  $body
     * @param  array  $headers
     * @param  int  $status
     * @return void
     */
    public function __construct($body, $headers, $status)
    {
        $this->body = $body;
        $this->status = $status;

        $this->headers = $this->prepareHeaders($headers);
    }

    /**
     * Prepare the given response headers.
     *
     * @param  array  $headers
     * @return array
     */
    protected function prepareHeaders(array $headers)
    {
        $headers = array_change_key_case($headers, CASE_LOWER);

        unset($headers['status']);

        return $headers;
    }
}


================================================
FILE: src/Runtime/Secrets.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

use Aws\Ssm\SsmClient;

class Secrets
{
    /**
     * Add all of the secret parameters at the given path to the environment.
     *
     * @param  string  $path
     * @param  array|null  $parameters
     * @param  string  $file
     * @return array
     */
    public static function addToEnvironment($path, $parameters, $file)
    {
        if (! $parameters && file_exists($file)) {
            $parameters = require $file;
        }

        return tap(static::all($path, (array) $parameters), function ($variables) {
            foreach ($variables as $key => $value) {
                $_ENV[$key] = $value;
                $_SERVER[$key] = $value;
            }
        });
    }

    /**
     * Get all of the secret parameters (AWS SSM) at the given path.
     *
     * @param  string  $path
     * @return array
     */
    public static function all($path, array $parameters = [])
    {
        if (empty($parameters)) {
            return [];
        }

        $ssm = SsmClient::factory([
            'region' => $_ENV['AWS_DEFAULT_REGION'],
            'version' => 'latest',
        ]);

        return collect($parameters)->chunk(10)->reduce(function ($carry, $parameters) use ($ssm, $path) {
            $ssmResponse = $ssm->getParameters([
                'Names' => collect($parameters)->map(function ($version, $parameter) use ($path) {
                    return $path.'/'.$parameter.':'.$version;
                })->values()->all(),
                'WithDecryption' => true,
            ]);

            return array_merge($carry, static::parseSecrets(
                $ssmResponse['Parameters'] ?? []
            ));
        }, []);
    }

    /**
     * Parse the secret names and values into an array.
     *
     * @return array
     */
    protected static function parseSecrets(array $secrets)
    {
        return collect($secrets)->mapWithKeys(function ($secret) {
            $segments = explode('/', $secret['Name']);

            return [$segments[count($segments) - 1] => $secret['Value']];
        })->all();
    }
}


================================================
FILE: src/Runtime/StorageDirectories.php
================================================
<?php

namespace Laravel\Vapor\Runtime;

class StorageDirectories
{
    /**
     * The storage path for the execution environment.
     *
     * @var string
     */
    public const PATH = '/tmp/storage';

    /**
     * Ensure the necessary storage directories exist.
     *
     * @return void
     */
    public static function create()
    {
        $directories = [
            self::PATH.'/app',
            self::PATH.'/logs',
            self::PATH.'/bootstrap/cache',
            self::PATH.'/framework/cache',
            self::PATH.'/framework/views',
        ];

        foreach ($directories as $directory) {
            if (! is_dir($directory)) {
                function_exists('__vapor_debug') && __vapor_debug("Creating storage directory: $directory");

                mkdir($directory, 0755, true);
            }
        }
    }
}


================================================
FILE: src/Vapor.php
================================================
<?php

namespace Laravel\Vapor;

class Vapor
{
    use HasAwsContext;

    /**
     * Determine whether the environment is Vapor.
     */
    public static function active(): bool
    {
        return env('VAPOR_SSM_PATH') !== null;
    }

    /**
     * Determine whether the environment is not Vapor.
     */
    public static function inactive(): bool
    {
        return ! static::active();
    }

    /**
     * Execute the callback if the environment is Vapor.
     *
     * @param  mixed  $whenActive
     * @param  mixed  $whenInactive
     * @return mixed
     */
    public static function whenActive($whenActive, $whenInactive = null)
    {
        if (static::active()) {
            return value($whenActive);
        }

        return value($whenInactive);
    }

    /**
     * Execute the callback if the environment is not Vapor.
     *
     * @param  mixed  $whenInactive
     * @param  mixed  $whenActive
     * @return mixed
     */
    public static function whenInactive($whenInactive, $whenActive = null)
    {
        return static::whenActive($whenActive, $whenInactive);
    }
}


================================================
FILE: src/VaporJobTimedOutException.php
================================================
<?php

namespace Laravel\Vapor;

use Exception;
use Throwable;

class VaporJobTimedOutException extends Exception
{
    /**
     * Create a new exception instance.
     *
     * @param  string  $name
     * @param  Throwable|null  $previous
     */
    public function __construct($name, ?Throwable $previous = null)
    {
        parent::__construct($name.' has timed out. It will be retried again.', 0, $previous);
    }
}


================================================
FILE: src/VaporServiceProvider.php
================================================
<?php

namespace Laravel\Vapor;

use Illuminate\Contracts\Console\Kernel as ConsoleKernel;
use Illuminate\Contracts\Http\Kernel as HttpKernel;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;
use Laravel\Vapor\Console\Commands\OctaneStatusCommand;
use Laravel\Vapor\Console\Commands\VaporHealthCheckCommand;
use Laravel\Vapor\Console\Commands\VaporQueueListFailedCommand;
use Laravel\Vapor\Console\Commands\VaporScheduleCommand;
use Laravel\Vapor\Console\Commands\VaporWorkCommand;
use Laravel\Vapor\Http\Controllers\SignedStorageUrlController;
use Laravel\Vapor\Http\Middleware\ServeStaticAssets;
use Laravel\Vapor\Queue\VaporConnector;

class VaporServiceProvider extends ServiceProvider
{
    use ConfiguresAssets, ConfiguresDynamoDb, ConfiguresQueue, ConfiguresRedis, ConfiguresSqs, DefinesRoutes;

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->ensureRoutesAreDefined();
        $this->registerOctaneCommands();

        if (($_ENV['VAPOR_SERVERLESS_DB'] ?? null) === 'true') {
            Schema::defaultStringLength(191);
        }

        if ($this->app->resolved('queue')) {
            call_user_func($this->queueExtender());
        } else {
            $this->app->afterResolving(
                'queue', $this->queueExtender()
            );
        }
    }

    /**
     * Get the queue extension callback.
     *
     * @return \Closure
     */
    protected function queueExtender()
    {
        return function () {
            Queue::extend('sqs', function () {
                return new VaporConnector;
            });
        };
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(
            Contracts\SignedStorageUrlController::class,
            SignedStorageUrlController::class
        );

        $this->configure();
        $this->offerPublishing();
        $this->ensureAssetPathsAreConfigured();
        $this->ensureRedisIsConfigured();
        $this->ensureDynamoDbIsConfigured();
        $this->ensureQueueIsConfigured();
        $this->ensureSqsIsConfigured();
        $this->ensureMixIsConfigured();
        $this->configureTrustedProxy();

        $this->registerMiddleware();
        $this->registerCommands();
    }

    /**
     * Setup the configuration for Horizon.
     *
     * @return void
     */
    protected function configure()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/vapor.php', 'vapor'
        );
    }

    /**
     * Setup the resource publishing groups for Horizon.
     *
     * @return void
     */
    protected function offerPublishing()
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__.'/../config/vapor.php' => config_path('vapor.php'),
            ], 'vapor-config');
        }
    }

    /**
     * Ensure Laravel Mix is properly configured.
     *
     * @return void
     */
    protected function ensureMixIsConfigured()
    {
        if (isset($_ENV['MIX_URL'])) {
            Config::set('app.mix_url', $_ENV['MIX_URL']);
        }
    }

    /**
     * Configure trusted proxy.
     *
     * @return void
     */
    private function configureTrustedProxy()
    {
        Config::set('trustedproxy.proxies', Config::get('trustedproxy.proxies') ?? ['0.0.0.0/0', '2000:0:0:0:0:0:0:0/3']);
    }

    /**
     * Register the Vapor HTTP middleware.
     *
     * @return void
     */
    protected function registerMiddleware()
    {
        $this->app[HttpKernel::class]->pushMiddleware(ServeStaticAssets::class);
    }

    /**
     * Register the Vapor console commands.
     *
     * @return void
     *
     * @throws \InvalidArgumentException
     */
    protected function registerCommands()
    {
        if (! $this->app->runningInConsole()) {
            return;
        }

        $this->app[ConsoleKernel::class]->command('vapor:handle {payload}', function () {
            throw new InvalidArgumentException(
                'Unknown event type. Please create a vapor:handle command to handle custom events.'
            );
        });

        $this->app->singleton('command.vapor.work', function ($app) {
            return new VaporWorkCommand($app['queue.vaporWorker']);
        });

        $this->app->singleton('command.vapor.queue-failed', function () {
            return new VaporQueueListFailedCommand;
        });

        $this->app->singleton('command.vapor.health-check', function () {
            return new VaporHealthCheckCommand;
        });

        $this->app->singleton('command.vapor.schedule', function () {
            return new VaporScheduleCommand;
        });

        $this->commands(['command.vapor.work', 'command.vapor.queue-failed', 'command.vapor.health-check', 'command.vapor.schedule']);
    }

    /**
     * Register the Vapor "Octane" console commands.
     *
     * @return void
     *
     * @throws \InvalidArgumentException
     */
    protected function registerOctaneCommands()
    {
        // Ensure we are running on Vapor...
        if (! isset($_ENV['VAPOR_SSM_PATH'])) {
            return;
        }

        if ($this->app->runningInConsole()) {
            $this->commands(OctaneStatusCommand::class);
        }
    }
}


================================================
FILE: src/debug.php
================================================
<?php

if (! function_exists('__vapor_debug')) {
    function __vapor_debug($message)
    {
        if (isset($_ENV['VAPOR_DEBUG']) && $_ENV['VAPOR_DEBUG'] === 'true') {
            fwrite(STDERR, $message.PHP_EOL);
        }
    }
}


================================================
FILE: stubs/503.html
================================================
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Service Unavailable</title>

        <!-- Fonts -->
        <link rel="dns-prefetch" href="//fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

        <!-- Styles -->
        <style>
            html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Nunito', sans-serif;
                font-weight: 100;
                height: 100vh;
                margin: 0;
            }

            .full-height {
                height: 100vh;
            }

            .flex-center {
                align-items: center;
                display: flex;
                justify-content: center;
            }

            .position-ref {
                position: relative;
            }

            .code {
                border-right: 2px solid;
                font-size: 26px;
                padding: 0 15px 0 15px;
                text-align: center;
            }

            .message {
                font-size: 18px;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div class="flex-center position-ref full-height">
            <div class="code">
                503
            </div>

            <div class="message" style="padding: 10px;">
                Service Unavailable
            </div>
        </div>
    </body>
</html>



================================================
FILE: stubs/cliRuntime.php
================================================
<?php

use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use Laravel\Vapor\Runtime\CliHandlerFactory;
use Laravel\Vapor\Runtime\Environment;
use Laravel\Vapor\Runtime\LambdaContainer;
use Laravel\Vapor\Runtime\LambdaRuntime;
use Laravel\Vapor\Runtime\Secrets;
use Laravel\Vapor\Runtime\StorageDirectories;

$app = require __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Inject SSM Secrets Into Environment
|--------------------------------------------------------------------------
|
| Next, we will inject any of the application's secrets stored in AWS
| SSM into the environment variables. These variables may be a bit
| larger than the variables allowed by Lambda which has a limit.
|
*/

Secrets::addToEnvironment(
    $_ENV['VAPOR_SSM_PATH'],
    json_decode($_ENV['VAPOR_SSM_VARIABLES'] ?? '[]', true),
    __DIR__.'/vaporSecrets.php'
);

/*
|--------------------------------------------------------------------------
| Inject Decrypted Environment Variables
|--------------------------------------------------------------------------
|
| Next, we will check to see whether a decryption key has been set on the
| environment. If so, we will attempt to discover an encrypted file at
| the root of the application and decrypt it into the Vapor runtime.
|
*/

Environment::decrypt($app);

/*
|--------------------------------------------------------------------------
| Cache Configuration
|--------------------------------------------------------------------------
|
| To give the application a speed boost, we are going to cache all of the
| configuration files into a single file. The file will be loaded once
| by the runtime then it will read the configuration values from it.
|
*/

StorageDirectories::create();

$app->useStoragePath(StorageDirectories::PATH);

if (isset($_ENV['VAPOR_MAINTENANCE_MODE']) &&
    $_ENV['VAPOR_MAINTENANCE_MODE'] === 'true') {
    file_put_contents($app->storagePath().'/framework/down', '[]');
}

function_exists('__vapor_debug') && __vapor_debug('Caching Laravel configuration');

try {
    $app->make(ConsoleKernelContract::class)->call('config:cache');
} catch (Throwable $e) {
    function_exists('__vapor_debug') && __vapor_debug('Failing caching Laravel configuration: '.$e->getMessage());
}

/*
|--------------------------------------------------------------------------
| Listen For Lambda Invocations
|--------------------------------------------------------------------------
|
| When receiving Lambda requests to the CLI environment, we simply send
| them to the appropriate handlers based on if they are CLI commands
| or queued jobs. Then we'll return a response back to the Lambda.
|
*/

$invocations = 0;

$lambdaRuntime = LambdaRuntime::fromEnvironmentVariable();

while (true) {
    $lambdaRuntime->nextInvocation(function ($invocationId, $event) {
        return CliHandlerFactory::make($event)
            ->handle($event)
            ->toApiGatewayFormat();
    });

    LambdaContainer::terminateIfInvocationLimitHasBeenReached(
        ++$invocations, (int) ($_ENV['VAPOR_MAX_REQUESTS'] ?? 250)
    );
}


================================================
FILE: stubs/fpmRuntime.php
================================================
<?php

use hollodotme\FastCGI\Exceptions\WriteFailedException;
use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use Illuminate\Support\Str;
use Laravel\Vapor\Runtime\Environment;
use Laravel\Vapor\Runtime\Fpm\Fpm;
use Laravel\Vapor\Runtime\Fpm\FpmHttpHandlerFactory;
use Laravel\Vapor\Runtime\LambdaContainer;
use Laravel\Vapor\Runtime\LambdaResponse;
use Laravel\Vapor\Runtime\LambdaRuntime;
use Laravel\Vapor\Runtime\Secrets;
use Laravel\Vapor\Runtime\StorageDirectories;

$app = require __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Inject SSM Secrets Into Environment
|--------------------------------------------------------------------------
|
| Next, we will inject any of the application's secrets stored in AWS
| SSM into the environment variables. These variables may be a bit
| larger than the variables allowed by Lambda which has a limit.
|
*/

function_exists('__vapor_debug') && __vapor_debug('Preparing to add secrets to runtime');

Secrets::addToEnvironment(
    $_ENV['VAPOR_SSM_PATH'],
    json_decode($_ENV['VAPOR_SSM_VARIABLES'] ?? '[]', true),
    __DIR__.'/vaporSecrets.php'
);

/*
|--------------------------------------------------------------------------
| Inject Decrypted Environment Variables
|--------------------------------------------------------------------------
|
| Next, we will check to see whether a decryption key has been set on the
| environment. If so, we will attempt to discover an encrypted file at
| the root of the application and decrypt it into the Vapor runtime.
|
*/

Environment::decrypt($app);

/*
|--------------------------------------------------------------------------
| Cache Configuration
|--------------------------------------------------------------------------
|
| To give the application a speed boost, we are going to cache all of the
| configuration files into a single file. The file will be loaded once
| by the runtime then it will read the configuration values from it.
|
*/

StorageDirectories::create();

$app->useStoragePath(StorageDirectories::PATH);

function_exists('__vapor_debug') && __vapor_debug('Caching Laravel configuration');

$app->make(ConsoleKernelContract::class)->call('config:cache');

/*
|--------------------------------------------------------------------------
| Start PHP-FPM
|--------------------------------------------------------------------------
|
| We need to boot the PHP-FPM process with the appropriate handler so it
| is ready to accept requests. This will initialize this process then
| wait for this socket to become ready before continuing execution.
|
*/

function_exists('__vapor_debug') && __vapor_debug('Preparing to boot FPM');

$fpm = Fpm::boot(
    __DIR__.'/httpHandler.php'
);

/*
|--------------------------------------------------------------------------
| Listen For Lambda Invocations
|--------------------------------------------------------------------------
|
| When using FPM, we will listen for Lambda invocations and proxy them
| through the FPM process. We'll then return formatted FPM response
| back to the user. We'll monitor FPM to make sure it is running.
|
*/

$invocations = 0;

$lambdaRuntime = LambdaRuntime::fromEnvironmentVariable();

while (true) {
    $lambdaRuntime->nextInvocation(function ($invocationId, $event) {
        try {
            return FpmHttpHandlerFactory::make($event)
                ->handle($event)
                ->toApiGatewayFormat();
        } catch (WriteFailedException $e) {
            if (Str::contains($e->getMessage(), 'Failed to write request to socket [broken pipe]')) {
                function_exists('__vapor_debug') && __vapor_debug($e->getMessage());

                return (new LambdaResponse(502, [], ''))
                    ->toApiGatewayFormat();
            }

            throw $e;
        }
    });

    $fpm->ensureRunning();

    LambdaContainer::terminateIfInvocationLimitHasBeenReached(
        ++$invocations, (int) ($_ENV['VAPOR_MAX_REQUESTS'] ?? 250)
    );
}


================================================
FILE: stubs/httpHandler.php
================================================
<?php

use Illuminate\Http\Request;
use Laravel\Vapor\Runtime\HttpKernel;

/**
 * Laravel - A PHP Framework For Web Artisans.
 *
 * @author   Taylor Otwell <taylor@laravel.com>
 */
define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$handler = new HttpKernel($app);

$response = $handler->handle(Request::capture());

$response->send();


================================================
FILE: stubs/httpRuntime.php
================================================
<?php

// This file exists for backwards compatibility purposes...


================================================
FILE: stubs/octaneRuntime.php
================================================
<?php

use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use Laravel\Vapor\Runtime\Environment;
use Laravel\Vapor\Runtime\LambdaContainer;
use Laravel\Vapor\Runtime\LambdaRuntime;
use Laravel\Vapor\Runtime\Octane\Octane;
use Laravel\Vapor\Runtime\Octane\OctaneHttpHandlerFactory;
use Laravel\Vapor\Runtime\Secrets;
use Laravel\Vapor\Runtime\StorageDirectories;

$app = require __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Inject SSM Secrets Into Environment
|--------------------------------------------------------------------------
|
| Next, we will inject any of the application's secrets stored in AWS
| SSM into the environment variables. These variables may be a bit
| larger than the variables allowed by Lambda which has a limit.
|
*/

function_exists('__vapor_debug') && __vapor_debug('Preparing to add secrets to runtime');

Secrets::addToEnvironment(
    $_ENV['VAPOR_SSM_PATH'],
    json_decode($_ENV['VAPOR_SSM_VARIABLES'] ?? '[]', true),
    __DIR__.'/vaporSecrets.php'
);

/*
|--------------------------------------------------------------------------
| Inject Decrypted Environment Variables
|--------------------------------------------------------------------------
|
| Next, we will check to see whether a decryption key has been set on the
| environment. If so, we will attempt to discover an encrypted file at
| the root of the application and decrypt it into the Vapor runtime.
|
*/

Environment::decrypt($app);

/*
|--------------------------------------------------------------------------
| Cache Configuration
|--------------------------------------------------------------------------
|
| To give the application a speed boost, we are going to cache all of the
| configuration files into a single file. The file will be loaded once
| by the runtime then it will read the configuration values from it.
|
*/

StorageDirectories::create();

$app->useStoragePath(StorageDirectories::PATH);

function_exists('__vapor_debug') && __vapor_debug('Caching Laravel configuration');

$app->make(ConsoleKernelContract::class)->call('config:cache');

/*
|--------------------------------------------------------------------------
| Start Octane Worker
|--------------------------------------------------------------------------
|
| We need to boot the application request Octane worker so it's ready to
| serve incoming requests. This will initialize this worker then wait
| for Lambda invocations to be received for this Vapor application.
|
*/
function_exists('__vapor_debug') && __vapor_debug('Preparing to boot Octane');

Octane::boot(
    __DIR__,
    getenv('OCTANE_DATABASE_SESSION_PERSIST') === 'true',
    getenv('OCTANE_DATABASE_SESSION_TTL') ?: 0
);

/*
|--------------------------------------------------------------------------
| Listen For Lambda Invocations
|--------------------------------------------------------------------------
|
| When using FPM, we will listen for Lambda invocations and proxy them
| through the FPM process. We'll then return formatted FPM response
| back to the user. We'll monitor FPM to make sure it is running.
|
*/

$invocations = 0;

$lambdaRuntime = LambdaRuntime::fromEnvironmentVariable();

while (true) {
    $lambdaRuntime->nextInvocation(function ($invocationId, $event) {
        return OctaneHttpHandlerFactory::make($event)
            ->handle($event)
            ->toApiGatewayFormat();
    });

    LambdaContainer::terminateIfInvocationLimitHasBeenReached(
        ++$invocations, (int) ($_ENV['VAPOR_MAX_REQUESTS'] ?? 250)
    );
}


================================================
FILE: stubs/php-fpm.conf
================================================
error_log = /dev/null
pid = /tmp/.vapor/php-fpm.pid
log_limit= 10000

[default]
pm = static
pm.max_children = 2
pm.max_requests = 250
listen = /tmp/.vapor/php-fpm.sock
clear_env = no
catch_workers_output = yes
decorate_workers_output = no


================================================
FILE: stubs/rds-combined-ca-bundle.pem
================================================
-----BEGIN CERTIFICATE-----
MIIEEjCCAvqgAwIBAgIJAM2ZN/+nPi27MA0GCSqGSIb3DQEBCwUAMIGVMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzEmMCQGA1UEAwwdQW1hem9uIFJEUyBhZi1zb3V0aC0xIFJvb3QgQ0Ew
HhcNMTkxMDI4MTgwNTU4WhcNMjQxMDI2MTgwNTU4WjCBlTELMAkGA1UEBhMCVVMx
EDAOBgNVBAcMB1NlYXR0bGUxEzARBgNVBAgMCldhc2hpbmd0b24xIjAgBgNVBAoM
GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx
JjAkBgNVBAMMHUFtYXpvbiBSRFMgYWYtc291dGgtMSBSb290IENBMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwR2351uPMZaJk2gMGT+1sk8HE9MQh2rc
/sCnbxGn2p1c7Oi9aBbd/GiFijeJb2BXvHU+TOq3d3Jjqepq8tapXVt4ojbTJNyC
J5E7r7KjTktKdLxtBE1MK25aY+IRJjtdU6vG3KiPKUT1naO3xs3yt0F76WVuFivd
9OHv2a+KHvPkRUWIxpmAHuMY9SIIMmEZtVE7YZGx5ah0iO4JzItHcbVR0y0PBH55
arpFBddpIVHCacp1FUPxSEWkOpI7q0AaU4xfX0fe1BV5HZYRKpBOIp1TtZWvJD+X
jGUtL1BEsT5vN5g9MkqdtYrC+3SNpAk4VtpvJrdjraI/hhvfeXNnAwIDAQABo2Mw
YTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUEEi/
WWMcBJsoGXg+EZwkQ0MscZQwHwYDVR0jBBgwFoAUEEi/WWMcBJsoGXg+EZwkQ0Ms
cZQwDQYJKoZIhvcNAQELBQADggEBAGDZ5js5Pc/gC58LJrwMPXFhJDBS8QuDm23C
FFUdlqucskwOS3907ErK1ZkmVJCIqFLArHqskFXMAkRZ2PNR7RjWLqBs+0znG5yH
hRKb4DXzhUFQ18UBRcvT6V6zN97HTRsEEaNhM/7k8YLe7P8vfNZ28VIoJIGGgv9D
wQBBvkxQ71oOmAG0AwaGD0ORGUfbYry9Dz4a4IcUsZyRWRMADixgrFv6VuETp26s
/+z+iqNaGWlELBKh3iQCT6Y/1UnkPLO42bxrCSyOvshdkYN58Q2gMTE1SVTqyo8G
Lw8lLAz9bnvUSgHzB3jRrSx6ggF/WRMRYlR++y6LXP4SAsSAaC0=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEEjCCAvqgAwIBAgIJAJYM4LxvTZA6MA0GCSqGSIb3DQEBCwUAMIGVMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzEmMCQGA1UEAwwdQW1hem9uIFJEUyBldS1zb3V0aC0xIFJvb3QgQ0Ew
HhcNMTkxMDMwMjAyMDM2WhcNMjQxMDI4MjAyMDM2WjCBlTELMAkGA1UEBhMCVVMx
EDAOBgNVBAcMB1NlYXR0bGUxEzARBgNVBAgMCldhc2hpbmd0b24xIjAgBgNVBAoM
GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx
JjAkBgNVBAMMHUFtYXpvbiBSRFMgZXUtc291dGgtMSBSb290IENBMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqM921jXCXeqpRNCS9CBPOe5N7gMaEt+D
s5uR3riZbqzRlHGiF1jZihkXfHAIQewDwy+Yz+Oec1aEZCQMhUHxZJPusuX0cJfj
b+UluFqHIijL2TfXJ3D0PVLLoNTQJZ8+GAPECyojAaNuoHbdVqxhOcznMsXIXVFq
yVLKDGvyKkJjai/iSPDrQMXufg3kWt0ISjNLvsG5IFXgP4gttsM8i0yvRd4QcHoo
DjvH7V3cS+CQqW5SnDrGnHToB0RLskE1ET+oNOfeN9PWOxQprMOX/zmJhnJQlTqD
QP7jcf7SddxrKFjuziFiouskJJyNDsMjt1Lf60+oHZhed2ogTeifGwIDAQABo2Mw
YTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUFBAF
cgJe/BBuZiGeZ8STfpkgRYQwHwYDVR0jBBgwFoAUFBAFcgJe/BBuZiGeZ8STfpkg
RYQwDQYJKoZIhvcNAQELBQADggEBAKAYUtlvDuX2UpZW9i1QgsjFuy/ErbW0dLHU
e/IcFtju2z6RLZ+uF+5A8Kme7IKG1hgt8s+w9TRVQS/7ukQzoK3TaN6XKXRosjtc
o9Rm4gYWM8bmglzY1TPNaiI4HC7546hSwJhubjN0bXCuj/0sHD6w2DkiGuwKNAef
yTu5vZhPkeNyXLykxkzz7bNp2/PtMBnzIp+WpS7uUDmWyScGPohKMq5PqvL59z+L
ZI3CYeMZrJ5VpXUg3fNNIz/83N3G0sk7wr0ohs/kHTP7xPOYB0zD7Ku4HA0Q9Swf
WX0qr6UQgTPMjfYDLffI7aEId0gxKw1eGYc6Cq5JAZ3ipi/cBFc=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEEjCCAvqgAwIBAgIJANew34ehz5l8MA0GCSqGSIb3DQEBCwUAMIGVMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzEmMCQGA1UEAwwdQW1hem9uIFJEUyBtZS1zb3V0aC0xIFJvb3QgQ0Ew
HhcNMTkwNTEwMjE0ODI3WhcNMjQwNTA4MjE0ODI3WjCBlTELMAkGA1UEBhMCVVMx
EDAOBgNVBAcMB1NlYXR0bGUxEzARBgNVBAgMCldhc2hpbmd0b24xIjAgBgNVBAoM
GUFtYXpvbiBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMx
JjAkBgNVBAMMHUFtYXpvbiBSRFMgbWUtc291dGgtMSBSb290IENBMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp7BYV88MukcY+rq0r79+C8UzkT30fEfT
aPXbx1d6M7uheGN4FMaoYmL+JE1NZPaMRIPTHhFtLSdPccInvenRDIatcXX+jgOk
UA6lnHQ98pwN0pfDUyz/Vph4jBR9LcVkBbe0zdoKKp+HGbMPRU0N2yNrog9gM5O8
gkU/3O2csJ/OFQNnj4c2NQloGMUpEmedwJMOyQQfcUyt9CvZDfIPNnheUS29jGSw
ERpJe/AENu8Pxyc72jaXQuD+FEi2Ck6lBkSlWYQFhTottAeGvVFNCzKszCntrtqd
rdYUwurYsLTXDHv9nW2hfDUQa0mhXf9gNDOBIVAZugR9NqNRNyYLHQIDAQABo2Mw
YTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU54cf
DjgwBx4ycBH8+/r8WXdaiqYwHwYDVR0jBBgwFoAU54cfDjgwBx4ycBH8+/r8WXda
iqYwDQYJKoZIhvcNAQELBQADggEBAIIMTSPx/dR7jlcxggr+O6OyY49Rlap2laKA
eC/XI4ySP3vQkIFlP822U9Kh8a9s46eR0uiwV4AGLabcu0iKYfXjPkIprVCqeXV7
ny9oDtrbflyj7NcGdZLvuzSwgl9SYTJp7PVCZtZutsPYlbJrBPHwFABvAkMvRtDB
hitIg4AESDGPoCl94sYHpfDfjpUDMSrAMDUyO6DyBdZH5ryRMAs3lGtsmkkNUrso
aTW6R05681Z0mvkRdb+cdXtKOSuDZPoe2wJJIaz3IlNQNSrB5TImMYgmt6iAsFhv
3vfTSTKrZDNTJn4ybG6pq1zWExoXsktZPylJly6R3RBwV6nwqBM=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEBjCCAu6gAwIBAgIJAMc0ZzaSUK51MA0GCSqGSIb3DQEBCwUAMIGPMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzEgMB4GA1UEAwwXQW1hem9uIFJEUyBSb290IDIwMTkgQ0EwHhcNMTkw
ODIyMTcwODUwWhcNMjQwODIyMTcwODUwWjCBjzELMAkGA1UEBhMCVVMxEDAOBgNV
BAcMB1NlYXR0bGUxEzARBgNVBAgMCldhc2hpbmd0b24xIjAgBgNVBAoMGUFtYXpv
biBXZWIgU2VydmljZXMsIEluYy4xEzARBgNVBAsMCkFtYXpvbiBSRFMxIDAeBgNV
BAMMF0FtYXpvbiBSRFMgUm9vdCAyMDE5IENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEArXnF/E6/Qh+ku3hQTSKPMhQQlCpoWvnIthzX6MK3p5a0eXKZ
oWIjYcNNG6UwJjp4fUXl6glp53Jobn+tWNX88dNH2n8DVbppSwScVE2LpuL+94vY
0EYE/XxN7svKea8YvlrqkUBKyxLxTjh+U/KrGOaHxz9v0l6ZNlDbuaZw3qIWdD/I
6aNbGeRUVtpM6P+bWIoxVl/caQylQS6CEYUk+CpVyJSkopwJlzXT07tMoDL5WgX9
O08KVgDNz9qP/IGtAcRduRcNioH3E9v981QO1zt/Gpb2f8NqAjUUCUZzOnij6mx9
McZ+9cWX88CRzR0vQODWuZscgI08NvM69Fn2SQIDAQABo2MwYTAOBgNVHQ8BAf8E
BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUc19g2LzLA5j0Kxc0LjZa
pmD/vB8wHwYDVR0jBBgwFoAUc19g2LzLA5j0Kxc0LjZapmD/vB8wDQYJKoZIhvcN
AQELBQADggEBAHAG7WTmyjzPRIM85rVj+fWHsLIvqpw6DObIjMWokpliCeMINZFV
ynfgBKsf1ExwbvJNzYFXW6dihnguDG9VMPpi2up/ctQTN8tm9nDKOy08uNZoofMc
NUZxKCEkVKZv+IL4oHoeayt8egtv3ujJM6V14AstMQ6SwvwvA93EP/Ug2e4WAXHu
cbI1NAbUgVDqp+DRdfvZkgYKryjTWd/0+1fS8X1bBZVWzl7eirNVnHbSH2ZDpNuY
0SBd8dj5F6ld3t58ydZbrTHze7JJOd8ijySAp4/kiu9UfZWuTPABzDa/DSdz9Dk/
zPW4CXXvhLmE02TA9/HeCw3KEHIwicNuEfw=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEEDCCAvigAwIBAgIJAKFMXyltvuRdMA0GCSqGSIb3DQEBCwUAMIGUMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzElMCMGA1UEAwwcQW1hem9uIFJEUyBCZXRhIFJvb3QgMjAxOSBDQTAe
Fw0xOTA4MTkxNzM4MjZaFw0yNDA4MTkxNzM4MjZaMIGUMQswCQYDVQQGEwJVUzEQ
MA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEiMCAGA1UECgwZ
QW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1hem9uIFJEUzEl
MCMGA1UEAwwcQW1hem9uIFJEUyBCZXRhIFJvb3QgMjAxOSBDQTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAMkZdnIH9ndatGAcFo+DppGJ1HUt4x+zeO+0
ZZ29m0sfGetVulmTlv2d5b66e+QXZFWpcPQMouSxxYTW08TbrQiZngKr40JNXftA
atvzBqIImD4II0ZX5UEVj2h98qe/ypW5xaDN7fEa5e8FkYB1TEemPaWIbNXqchcL
tV7IJPr3Cd7Z5gZJlmujIVDPpMuSiNaal9/6nT9oqN+JSM1fx5SzrU5ssg1Vp1vv
5Xab64uOg7wCJRB9R2GC9XD04odX6VcxUAGrZo6LR64ZSifupo3l+R5sVOc5i8NH
skdboTzU9H7+oSdqoAyhIU717PcqeDum23DYlPE2nGBWckE+eT8CAwEAAaNjMGEw
DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFK2hDBWl
sbHzt/EHd0QYOooqcFPhMB8GA1UdIwQYMBaAFK2hDBWlsbHzt/EHd0QYOooqcFPh
MA0GCSqGSIb3DQEBCwUAA4IBAQAO/718k8EnOqJDx6wweUscGTGL/QdKXUzTVRAx
JUsjNUv49mH2HQVEW7oxszfH6cPCaupNAddMhQc4C/af6GHX8HnqfPDk27/yBQI+
yBBvIanGgxv9c9wBbmcIaCEWJcsLp3HzXSYHmjiqkViXwCpYfkoV3Ns2m8bp+KCO
y9XmcCKRaXkt237qmoxoh2sGmBHk2UlQtOsMC0aUQ4d7teAJG0q6pbyZEiPyKZY1
XR/UVxMJL0Q4iVpcRS1kaNCMfqS2smbLJeNdsan8pkw1dvPhcaVTb7CvjhJtjztF
YfDzAI5794qMlWxwilKMmUvDlPPOTen8NNHkLwWvyFCH7Doh
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIEFjCCAv6gAwIBAgIJAMzYZJ+R9NBVMA0GCSqGSIb3DQEBCwUAMIGXMQswCQYD
VQQGEwJVUzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEi
MCAGA1UECgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1h
em9uIFJEUzEoMCYGA1UEAwwfQW1hem9uIFJEUyBQcmV2aWV3IFJvb3QgMjAxOSBD
QTAeFw0xOTA4MjEyMjI5NDlaFw0yNDA4MjEyMjI5NDlaMIGXMQswCQYDVQQGEwJV
UzEQMA4GA1UEBwwHU2VhdHRsZTETMBEGA1UECAwKV2FzaGluZ3RvbjEiMCAGA1UE
CgwZQW1hem9uIFdlYiBTZXJ2aWNlcywgSW5jLjETMBEGA1UECwwKQW1hem9uIFJE
UzEoMCYGA1U
Download .txt
gitextract__wb9ole1/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── SECURITY.md
│   ├── SUPPORT.md
│   └── workflows/
│       ├── static-analysis.yml
│       ├── tests.yml
│       └── update-changelog.yml
├── .gitignore
├── .styleci.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── composer.json
├── config/
│   └── vapor.php
├── phpstan.neon.dist
├── phpunit.xml.dist
├── src/
│   ├── Arr.php
│   ├── ConfiguresAssets.php
│   ├── ConfiguresDynamoDb.php
│   ├── ConfiguresQueue.php
│   ├── ConfiguresRedis.php
│   ├── ConfiguresSqs.php
│   ├── Console/
│   │   └── Commands/
│   │       ├── OctaneStatusCommand.php
│   │       ├── VaporHealthCheckCommand.php
│   │       ├── VaporQueueListFailedCommand.php
│   │       ├── VaporScheduleCommand.php
│   │       ├── VaporWorkCommand.php
│   │       └── WritesQueueEventMessages.php
│   ├── Contracts/
│   │   ├── LambdaEventHandler.php
│   │   ├── LambdaResponse.php
│   │   └── SignedStorageUrlController.php
│   ├── DefinesRoutes.php
│   ├── Events/
│   │   └── LambdaEvent.php
│   ├── HasAwsContext.php
│   ├── Http/
│   │   ├── Controllers/
│   │   │   └── SignedStorageUrlController.php
│   │   └── Middleware/
│   │       └── ServeStaticAssets.php
│   ├── Logging/
│   │   └── JsonFormatter.php
│   ├── Queue/
│   │   ├── JobAttempts.php
│   │   ├── VaporConnector.php
│   │   ├── VaporJob.php
│   │   ├── VaporQueue.php
│   │   └── VaporWorker.php
│   ├── Runtime/
│   │   ├── ArrayLambdaResponse.php
│   │   ├── CliHandlerFactory.php
│   │   ├── Environment.php
│   │   ├── Fpm/
│   │   │   ├── ActsAsFastCgiDataProvider.php
│   │   │   ├── Fpm.php
│   │   │   ├── FpmApplication.php
│   │   │   ├── FpmHttpHandlerFactory.php
│   │   │   ├── FpmRequest.php
│   │   │   ├── FpmResponse.php
│   │   │   └── FpmResponseHeaders.php
│   │   ├── Handlers/
│   │   │   ├── CliHandler.php
│   │   │   ├── FpmHandler.php
│   │   │   ├── LoadBalancedFpmHandler.php
│   │   │   ├── LoadBalancedOctaneHandler.php
│   │   │   ├── OctaneHandler.php
│   │   │   ├── PayloadFormatVersion2FpmHandler.php
│   │   │   ├── PayloadFormatVersion2OctaneHandler.php
│   │   │   ├── QueueHandler.php
│   │   │   ├── UnknownEventHandler.php
│   │   │   ├── WarmerHandler.php
│   │   │   └── WarmerPingHandler.php
│   │   ├── Http/
│   │   │   └── Middleware/
│   │   │       ├── EnsureBinaryEncoding.php
│   │   │       ├── EnsureOnNakedDomain.php
│   │   │       ├── EnsureVanityUrlIsNotIndexed.php
│   │   │       └── RedirectStaticAssets.php
│   │   ├── HttpKernel.php
│   │   ├── LambdaContainer.php
│   │   ├── LambdaInvocation.php
│   │   ├── LambdaResponse.php
│   │   ├── LambdaRuntime.php
│   │   ├── LoadBalancedLambdaResponse.php
│   │   ├── Logger.php
│   │   ├── NotifiesLambda.php
│   │   ├── Octane/
│   │   │   ├── Octane.php
│   │   │   ├── OctaneHttpHandlerFactory.php
│   │   │   └── OctaneRequestContextFactory.php
│   │   ├── PayloadFormatVersion2LambdaResponse.php
│   │   ├── Request.php
│   │   ├── Response.php
│   │   ├── Secrets.php
│   │   └── StorageDirectories.php
│   ├── Vapor.php
│   ├── VaporJobTimedOutException.php
│   ├── VaporServiceProvider.php
│   └── debug.php
├── stubs/
│   ├── 503.html
│   ├── cliRuntime.php
│   ├── fpmRuntime.php
│   ├── httpHandler.php
│   ├── httpRuntime.php
│   ├── octaneRuntime.php
│   ├── php-fpm.conf
│   ├── rds-combined-ca-bundle.pem
│   ├── runtime-with-vendor-download.php
│   └── runtime.php
└── tests/
    ├── Feature/
    │   ├── ApiGatewayOctaneHandlerTest.php
    │   ├── Commands/
    │   │   └── OctaneStatusCommandTest.php
    │   ├── EnsureOnNakedDomainTest.php
    │   ├── LambdaProxyOctaneHandlerTest.php
    │   ├── LoadBalancedOctaneHandlerTest.php
    │   ├── OctaneManageDatabaseSessionsTest.php
    │   ├── OctaneTest.php
    │   ├── RedirectStaticAssetsTest.php
    │   ├── SignedStorageUrlEndpointTest.php
    │   ├── VaporJobTest.php
    │   └── VaporQueueTest.php
    ├── Fixtures/
    │   ├── 503.json
    │   ├── asset.js
    │   ├── customLambdaEventFromSQS.json
    │   ├── customNonSQSLambdaEvent.json
    │   └── jobLambdaEventFromSQS.json
    ├── TestCase.php
    └── Unit/
        ├── FakeJob.php
        ├── FpmRequestTest.php
        ├── HttpKernelTest.php
        ├── LambdaEventTest.php
        ├── LoadBalancedLambdaResponseTest.php
        ├── Logging/
        │   └── JsonFormatterTest.php
        ├── OctaneHttpHandlerFactoryTest.php
        ├── QueueHandlerTest.php
        ├── Runtime/
        │   └── CliHandlerFactoryTest.php
        ├── VaporConnectorTest.php
        ├── VaporScheduleCommandTest.php
        ├── VaporTest.php
        └── VaporWorkCommandTest.php
Download .txt
SYMBOL INDEX (518 symbols across 96 files)

FILE: src/Arr.php
  class Arr (line 33) | class Arr
    method setMultipartArrayValue (line 43) | public static function setMultipartArrayValue(array $array, string $na...
    method malformedMultipartSegment (line 93) | protected static function malformedMultipartSegment($segment)

FILE: src/ConfiguresAssets.php
  type ConfiguresAssets (line 7) | trait ConfiguresAssets
    method ensureAssetPathsAreConfigured (line 14) | protected function ensureAssetPathsAreConfigured()

FILE: src/ConfiguresDynamoDb.php
  type ConfiguresDynamoDb (line 7) | trait ConfiguresDynamoDb
    method ensureDynamoDbIsConfigured (line 14) | protected function ensureDynamoDbIsConfigured()

FILE: src/ConfiguresQueue.php
  type ConfiguresQueue (line 11) | trait ConfiguresQueue
    method ensureQueueIsConfigured (line 18) | protected function ensureQueueIsConfigured()

FILE: src/ConfiguresRedis.php
  type ConfiguresRedis (line 8) | trait ConfiguresRedis
    method ensureRedisIsConfigured (line 15) | protected function ensureRedisIsConfigured()

FILE: src/ConfiguresSqs.php
  type ConfiguresSqs (line 7) | trait ConfiguresSqs
    method ensureSqsIsConfigured (line 14) | protected function ensureSqsIsConfigured()

FILE: src/Console/Commands/OctaneStatusCommand.php
  class OctaneStatusCommand (line 7) | class OctaneStatusCommand extends Command
    method handle (line 28) | public function handle()
    method isEnvironmentRunningOnOctane (line 40) | protected function isEnvironmentRunningOnOctane()

FILE: src/Console/Commands/VaporHealthCheckCommand.php
  class VaporHealthCheckCommand (line 10) | class VaporHealthCheckCommand extends Command
    method handle (line 38) | public function handle()
    method ensureBaseConfigurationFilesWereHarmonized (line 52) | protected function ensureBaseConfigurationFilesWereHarmonized()
    method ensureCacheIsWorking (line 72) | protected function ensureCacheIsWorking()

FILE: src/Console/Commands/VaporQueueListFailedCommand.php
  class VaporQueueListFailedCommand (line 10) | class VaporQueueListFailedCommand extends Command
    method handle (line 44) | public function handle()
    method extractJobName (line 112) | private function extractJobName($payload)
    method extractMessage (line 129) | private function extractMessage($exception)
    method matchJobName (line 152) | protected function matchJobName($payload)
    method filter (line 167) | protected function filter($job, $option, $value)

FILE: src/Console/Commands/VaporScheduleCommand.php
  class VaporScheduleCommand (line 9) | class VaporScheduleCommand extends Command
    method handle (line 35) | public function handle(): int
    method ensureValidCacheDriver (line 70) | protected function ensureValidCacheDriver(): ?Repository
    method obtainLock (line 84) | protected function obtainLock(Repository $cache, string $key): bool
    method releaseLock (line 94) | protected function releaseLock(Repository $cache): void

FILE: src/Console/Commands/VaporWorkCommand.php
  class VaporWorkCommand (line 12) | class VaporWorkCommand extends Command
    method __construct (line 61) | public function __construct(VaporWorker $worker)
    method handle (line 74) | public function handle(LambdaEvent $event)
    method marshalJob (line 101) | protected function marshalJob(array $message)
    method normalizeMessage (line 119) | protected function normalizeMessage(array $message)
    method message (line 136) | protected function message($event)
    method queueUrl (line 147) | protected function queueUrl(array $message)
    method gatherWorkerOptions (line 164) | protected function gatherWorkerOptions()
    method logFailedJob (line 189) | protected function logFailedJob(JobFailed $event)
    method downForMaintenance (line 202) | protected function downForMaintenance()
    method flushState (line 216) | public static function flushState()

FILE: src/Console/Commands/WritesQueueEventMessages.php
  type WritesQueueEventMessages (line 10) | trait WritesQueueEventMessages
    method listenForEvents (line 17) | protected function listenForEvents()
    method writeOutput (line 41) | protected function writeOutput(Job $job, $status)
    method writeStatus (line 61) | protected function writeStatus(Job $job, $status, $type)

FILE: src/Contracts/LambdaEventHandler.php
  type LambdaEventHandler (line 5) | interface LambdaEventHandler
    method handle (line 13) | public function handle(array $event);

FILE: src/Contracts/LambdaResponse.php
  type LambdaResponse (line 5) | interface LambdaResponse
    method toApiGatewayFormat (line 12) | public function toApiGatewayFormat();

FILE: src/Contracts/SignedStorageUrlController.php
  type SignedStorageUrlController (line 7) | interface SignedStorageUrlController
    method store (line 15) | public function store(Request $request);

FILE: src/DefinesRoutes.php
  type DefinesRoutes (line 7) | trait DefinesRoutes
    method ensureRoutesAreDefined (line 14) | public function ensureRoutesAreDefined()

FILE: src/Events/LambdaEvent.php
  class LambdaEvent (line 9) | class LambdaEvent implements ArrayAccess, Arrayable
    method __construct (line 24) | public function __construct($event)
    method offsetExists (line 35) | #[\ReturnTypeWillChange]
    method offsetGet (line 47) | #[\ReturnTypeWillChange]
    method offsetSet (line 60) | #[\ReturnTypeWillChange]
    method offsetUnset (line 72) | #[\ReturnTypeWillChange]
    method toArray (line 83) | public function toArray()

FILE: src/HasAwsContext.php
  type HasAwsContext (line 5) | trait HasAwsContext
    method requestId (line 12) | public static function requestId(): ?string
    method functionName (line 22) | public static function functionName(): ?string
    method functionVersion (line 32) | public static function functionVersion(): ?string
    method logGroupName (line 42) | public static function logGroupName(): ?string
    method logStreamName (line 52) | public static function logStreamName(): ?string
    method awsContext (line 68) | protected function awsContext(): array

FILE: src/Http/Controllers/SignedStorageUrlController.php
  class SignedStorageUrlController (line 13) | class SignedStorageUrlController extends Controller implements SignedSto...
    method store (line 21) | public function store(Request $request)
    method createCommand (line 61) | protected function createCommand(Request $request, S3Client $client, $...
    method headers (line 80) | protected function headers(Request $request, $signedRequest)
    method ensureEnvironmentVariablesAreAvailable (line 96) | protected function ensureEnvironmentVariablesAreAvailable(Request $req...
    method storageClient (line 119) | protected function storageClient()
    method getKey (line 154) | protected function getKey(string $uuid)
    method defaultVisibility (line 164) | protected function defaultVisibility()

FILE: src/Http/Middleware/ServeStaticAssets.php
  class ServeStaticAssets (line 9) | class ServeStaticAssets
    method handle (line 19) | public function handle($request, Closure $next, ...$guards)

FILE: src/Logging/JsonFormatter.php
  class JsonFormatter (line 8) | class JsonFormatter extends BaseJsonFormatter
    method format (line 13) | public function format($record): string

FILE: src/Queue/JobAttempts.php
  class JobAttempts (line 8) | class JobAttempts
    method __construct (line 28) | public function __construct(Cache $cache)
    method has (line 39) | protected function has($job)
    method get (line 50) | public function get($job)
    method increment (line 61) | public function increment($job)
    method transfer (line 79) | public function transfer($from, $to)
    method forget (line 92) | public function forget($job)
    method key (line 103) | protected function key($job)

FILE: src/Queue/VaporConnector.php
  class VaporConnector (line 9) | class VaporConnector implements ConnectorInterface
    method connect (line 17) | public function connect(array $config)
    method getDefaultConfiguration (line 40) | protected function getDefaultConfiguration(array $config)

FILE: src/Queue/VaporJob.php
  class VaporJob (line 7) | class VaporJob extends SqsJob
    method attempts (line 14) | public function attempts()
    method delete (line 27) | public function delete()
    method release (line 42) | public function release($delay = 0)

FILE: src/Queue/VaporQueue.php
  class VaporQueue (line 7) | class VaporQueue extends SqsQueue
    method pop (line 15) | public function pop($queue = null)
    method createPayloadArray (line 42) | protected function createPayloadArray($job, $queue, $data = '')

FILE: src/Queue/VaporWorker.php
  class VaporWorker (line 9) | class VaporWorker extends Worker
    method runVaporJob (line 19) | public function runVaporJob($job, $connectionName, WorkerOptions $opti...

FILE: src/Runtime/ArrayLambdaResponse.php
  class ArrayLambdaResponse (line 7) | class ArrayLambdaResponse implements LambdaResponse
    method __construct (line 22) | public function __construct(array $response)
    method toApiGatewayFormat (line 32) | public function toApiGatewayFormat()

FILE: src/Runtime/CliHandlerFactory.php
  class CliHandlerFactory (line 8) | class CliHandlerFactory
    method make (line 23) | public static function make(array $event)
    method createHandlerUsing (line 44) | public static function createHandlerUsing(callable $callback)
    method createHandlersNormally (line 54) | public static function createHandlersNormally()

FILE: src/Runtime/Environment.php
  class Environment (line 10) | class Environment
    method __construct (line 59) | public function __construct(Application $app)
    method decrypt (line 73) | public static function decrypt($app)
    method decryptEnvironment (line 83) | public function decryptEnvironment()
    method canBeDecrypted (line 105) | public function canBeDecrypted()
    method copyEncryptedFile (line 131) | public function copyEncryptedFile()
    method decryptFile (line 144) | public function decryptFile()
    method loadEnvironment (line 156) | public function loadEnvironment()
    method console (line 168) | public function console()

FILE: src/Runtime/Fpm/ActsAsFastCgiDataProvider.php
  type ActsAsFastCgiDataProvider (line 5) | trait ActsAsFastCgiDataProvider
    method getGatewayInterface (line 10) | public function getGatewayInterface(): string
    method getRequestMethod (line 18) | public function getRequestMethod(): string
    method getScriptFilename (line 26) | public function getScriptFilename(): string
    method getServerSoftware (line 34) | public function getServerSoftware(): string
    method getRemoteAddress (line 42) | public function getRemoteAddress(): string
    method getRemotePort (line 50) | public function getRemotePort(): int
    method getServerAddress (line 58) | public function getServerAddress(): string
    method getServerPort (line 66) | public function getServerPort(): int
    method getServerName (line 74) | public function getServerName(): string
    method getServerProtocol (line 82) | public function getServerProtocol(): string
    method getContentType (line 90) | public function getContentType(): string
    method getContentLength (line 98) | public function getContentLength(): int
    method getContent (line 108) | public function getContent(): string
    method getCustomVars (line 116) | public function getCustomVars(): array
    method getParams (line 124) | public function getParams(): array
    method getRequestUri (line 132) | public function getRequestUri(): string
    method getResponseCallbacks (line 140) | public function getResponseCallbacks(): array
    method getFailureCallbacks (line 148) | public function getFailureCallbacks(): array
    method getPassThroughCallbacks (line 156) | public function getPassThroughCallbacks(): array

FILE: src/Runtime/Fpm/Fpm.php
  class Fpm (line 11) | class Fpm
    method __construct (line 68) | public function __construct(Client $client, UnixDomainSocket $socketCo...
    method boot (line 82) | public static function boot($handler, array $serverVariables = [])
    method resolve (line 100) | public static function resolve()
    method start (line 108) | public function start()
    method ensureReadyToStart (line 142) | protected function ensureReadyToStart()
    method handle (line 162) | public function handle($request)
    method ensureFpmHasStarted (line 173) | protected function ensureFpmHasStarted()
    method isReady (line 197) | protected function isReady()
    method ensureRunning (line 211) | public function ensureRunning()
    method stop (line 229) | public function stop()
    method killExistingFpm (line 241) | protected function killExistingFpm()
    method removeFpmProcessFiles (line 271) | protected function removeFpmProcessFiles()
    method waitUntilStopped (line 283) | protected function waitUntilStopped($pid)
    method process (line 303) | public function process()
    method handler (line 313) | public function handler()
    method serverVariables (line 323) | public function serverVariables()
    method __destruct (line 333) | public function __destruct()

FILE: src/Runtime/Fpm/FpmApplication.php
  class FpmApplication (line 8) | class FpmApplication
    method __construct (line 31) | public function __construct(Client $client, UnixDomainSocket $socketCo...
    method handle (line 43) | public function handle(FpmRequest $request)

FILE: src/Runtime/Fpm/FpmHttpHandlerFactory.php
  class FpmHttpHandlerFactory (line 12) | class FpmHttpHandlerFactory
    method make (line 20) | public static function make(array $event)

FILE: src/Runtime/Fpm/FpmRequest.php
  class FpmRequest (line 8) | class FpmRequest extends Request implements ProvidesRequestData

FILE: src/Runtime/Fpm/FpmResponse.php
  class FpmResponse (line 8) | class FpmResponse extends Response
    method __construct (line 16) | public function __construct(ProvidesResponseData $response)
    method prepareStatus (line 32) | protected function prepareStatus(array $headers)

FILE: src/Runtime/Fpm/FpmResponseHeaders.php
  class FpmResponseHeaders (line 5) | class FpmResponseHeaders
    method fromBody (line 13) | public static function fromBody($body)

FILE: src/Runtime/Handlers/CliHandler.php
  class CliHandler (line 12) | class CliHandler implements LambdaEventHandler
    method handle (line 19) | public function handle(array $event)
    method ping (line 64) | protected function ping($callback, $response)

FILE: src/Runtime/Handlers/FpmHandler.php
  class FpmHandler (line 10) | class FpmHandler implements LambdaEventHandler
    method handle (line 17) | public function handle(array $event)
    method request (line 30) | public function request($event)
    method response (line 43) | public function response($response)
    method serverVariables (line 57) | public function serverVariables()

FILE: src/Runtime/Handlers/LoadBalancedFpmHandler.php
  class LoadBalancedFpmHandler (line 7) | class LoadBalancedFpmHandler extends FpmHandler
    method response (line 15) | public function response($response)

FILE: src/Runtime/Handlers/LoadBalancedOctaneHandler.php
  class LoadBalancedOctaneHandler (line 7) | class LoadBalancedOctaneHandler extends OctaneHandler
    method response (line 15) | public function response($response)

FILE: src/Runtime/Handlers/OctaneHandler.php
  class OctaneHandler (line 11) | class OctaneHandler implements LambdaEventHandler
    method handle (line 21) | public function handle(array $event)
    method request (line 36) | protected function request($event)
    method response (line 47) | protected function response($response)
    method serverVariables (line 61) | public function serverVariables()

FILE: src/Runtime/Handlers/PayloadFormatVersion2FpmHandler.php
  class PayloadFormatVersion2FpmHandler (line 8) | class PayloadFormatVersion2FpmHandler extends FpmHandler implements Lamb...
    method response (line 16) | public function response($response)

FILE: src/Runtime/Handlers/PayloadFormatVersion2OctaneHandler.php
  class PayloadFormatVersion2OctaneHandler (line 8) | class PayloadFormatVersion2OctaneHandler extends OctaneHandler implement...
    method response (line 16) | protected function response($response)

FILE: src/Runtime/Handlers/QueueHandler.php
  class QueueHandler (line 13) | class QueueHandler implements LambdaEventHandler
    method __construct (line 27) | public function __construct()
    method handle (line 40) | public function handle(array $event)
    method terminate (line 88) | protected function terminate()

FILE: src/Runtime/Handlers/UnknownEventHandler.php
  class UnknownEventHandler (line 9) | class UnknownEventHandler implements LambdaEventHandler
    method handle (line 17) | public function handle(array $event)

FILE: src/Runtime/Handlers/WarmerHandler.php
  class WarmerHandler (line 12) | class WarmerHandler implements LambdaEventHandler
    method handle (line 19) | public function handle(array $event)
    method buildPromises (line 41) | protected function buildPromises(LambdaClient $lambda, array $event)
    method lambdaClient (line 59) | protected function lambdaClient()

FILE: src/Runtime/Handlers/WarmerPingHandler.php
  class WarmerPingHandler (line 8) | class WarmerPingHandler implements LambdaEventHandler
    method handle (line 16) | public function handle(array $event)

FILE: src/Runtime/Http/Middleware/EnsureBinaryEncoding.php
  class EnsureBinaryEncoding (line 8) | class EnsureBinaryEncoding
    method handle (line 17) | public function handle($request, $next)
    method isBase64EncodingRequired (line 34) | public static function isBase64EncodingRequired(Response $response): bool

FILE: src/Runtime/Http/Middleware/EnsureOnNakedDomain.php
  class EnsureOnNakedDomain (line 8) | class EnsureOnNakedDomain
    method handle (line 17) | public function handle($request, $next)

FILE: src/Runtime/Http/Middleware/EnsureVanityUrlIsNotIndexed.php
  class EnsureVanityUrlIsNotIndexed (line 5) | class EnsureVanityUrlIsNotIndexed
    method handle (line 14) | public function handle($request, $next)

FILE: src/Runtime/Http/Middleware/RedirectStaticAssets.php
  class RedirectStaticAssets (line 7) | class RedirectStaticAssets
    method handle (line 16) | public function handle($request, $next)

FILE: src/Runtime/HttpKernel.php
  class HttpKernel (line 21) | class HttpKernel
    method __construct (line 36) | public function __construct(Application $app)
    method handle (line 47) | public function handle(Request $request)
    method shouldSendMaintenanceModeResponse (line 92) | public static function shouldSendMaintenanceModeResponse(Request $requ...
    method hasValidBypassCookie (line 106) | public static function hasValidBypassCookie($request, $secret)
    method bypassResponse (line 121) | public static function bypassResponse(string $secret)
    method resolveKernel (line 145) | protected function resolveKernel(Request $request)
    method sendRequest (line 162) | protected function sendRequest(Request $request)

FILE: src/Runtime/LambdaContainer.php
  class LambdaContainer (line 7) | class LambdaContainer
    method terminateIfInvocationLimitHasBeenReached (line 16) | public static function terminateIfInvocationLimitHasBeenReached($invoc...

FILE: src/Runtime/LambdaInvocation.php
  class LambdaInvocation (line 7) | class LambdaInvocation
    method next (line 22) | public static function next($apiUrl)
    method ensureNoErrorsOccurred (line 73) | protected static function ensureNoErrorsOccurred($invocationId, $body)

FILE: src/Runtime/LambdaResponse.php
  class LambdaResponse (line 8) | class LambdaResponse implements LambdaResponseContract
    method __construct (line 39) | public function __construct(int $status, array $headers, $body)
    method toApiGatewayFormat (line 51) | public function toApiGatewayFormat()
    method prepareHeaders (line 69) | protected function prepareHeaders(array $responseHeaders)
    method buildCookieHeaders (line 100) | protected function buildCookieHeaders(array $values)
    method cookiePermutation (line 117) | protected function cookiePermutation($index)
    method normalizeHeaderName (line 168) | protected function normalizeHeaderName($name)

FILE: src/Runtime/LambdaRuntime.php
  class LambdaRuntime (line 8) | class LambdaRuntime
    method __construct (line 25) | public function __construct($apiUrl)
    method fromEnvironmentVariable (line 35) | public static function fromEnvironmentVariable()
    method nextInvocation (line 45) | public function nextInvocation(callable $callback)
    method handleException (line 65) | public function handleException(string $invocationId, Throwable $error)

FILE: src/Runtime/LoadBalancedLambdaResponse.php
  class LoadBalancedLambdaResponse (line 7) | class LoadBalancedLambdaResponse extends LambdaResponse
    method toApiGatewayFormat (line 14) | public function toApiGatewayFormat()
    method statusText (line 33) | public function statusText($status)
    method prepareHeaders (line 48) | protected function prepareHeaders(array $responseHeaders)
    method normalizeHeaderValues (line 69) | protected function normalizeHeaderValues($values)

FILE: src/Runtime/Logger.php
  class Logger (line 9) | class Logger
    method info (line 25) | public static function info($message, array $context = [])
    method error (line 39) | public static function error($message, array $context = [])
    method ensureLoggerIsAvailable (line 51) | protected static function ensureLoggerIsAvailable()

FILE: src/Runtime/NotifiesLambda.php
  type NotifiesLambda (line 7) | trait NotifiesLambda
    method notifyLambdaOfResponse (line 16) | protected function notifyLambdaOfResponse($invocationId, $data)
    method notifyLambdaOfError (line 30) | protected function notifyLambdaOfError($invocationId, $data)
    method lambdaRequest (line 44) | protected function lambdaRequest($url, $data)

FILE: src/Runtime/Octane/Octane.php
  class Octane (line 29) | class Octane implements Client
    method boot (line 69) | public static function boot($basePath, $databaseSessionPersist = false...
    method manageDatabaseSessions (line 99) | protected static function manageDatabaseSessions($databaseSessionPersi...
    method handle (line 144) | public static function handle($request)
    method sendRequest (line 196) | protected static function sendRequest($request, $context)
    method hasValidBypassCookie (line 218) | public static function hasValidBypassCookie($request, $secret)
    method terminate (line 228) | public static function terminate()
    method marshalRequest (line 242) | public function marshalRequest(RequestContext $context): array
    method respond (line 253) | public function respond(RequestContext $context, OctaneResponse $respo...
    method error (line 261) | public function error(Throwable $e, Application $app, Request $request...
    method ensureServerSoftware (line 283) | protected static function ensureServerSoftware($software)
    method worker (line 294) | public static function worker()
    method captureContent (line 302) | protected static function captureContent(StreamedResponse $response): ...

FILE: src/Runtime/Octane/OctaneHttpHandlerFactory.php
  class OctaneHttpHandlerFactory (line 12) | class OctaneHttpHandlerFactory
    method make (line 20) | public static function make(array $event)

FILE: src/Runtime/Octane/OctaneRequestContextFactory.php
  class OctaneRequestContextFactory (line 15) | class OctaneRequestContextFactory
    method fromEvent (line 24) | public static function fromEvent($event, $serverVariables)
    method cookies (line 67) | protected static function cookies($event, $headers)
    method createFile (line 100) | protected static function createFile($part)
    method parseFiles (line 123) | protected static function parseFiles($contentType, $body)
    method uploadedFiles (line 149) | protected static function uploadedFiles($method, $contentType, $body)
    method parsedBody (line 168) | protected static function parsedBody($method, $contentType, $body)
    method parseBody (line 190) | protected static function parseBody($contentType, $body)
    method parseUri (line 214) | protected static function parseUri($uri)
    method isUrlEncodedForm (line 229) | protected static function isUrlEncodedForm($contentType)

FILE: src/Runtime/PayloadFormatVersion2LambdaResponse.php
  class PayloadFormatVersion2LambdaResponse (line 8) | class PayloadFormatVersion2LambdaResponse extends LambdaResponse impleme...
    method toApiGatewayFormat (line 15) | public function toApiGatewayFormat()
    method prepareHeaders (line 34) | protected function prepareHeaders(array $responseHeaders)

FILE: src/Runtime/Request.php
  class Request (line 7) | class Request
    method __construct (line 38) | public function __construct(array $serverVariables, $body, $headers)
    method fromLambdaEvent (line 53) | public static function fromLambdaEvent(array $event, array $serverVari...
    method getUriAndQueryString (line 111) | protected static function getUriAndQueryString(array $event)
    method getQueryString (line 131) | protected static function getQueryString(array $event)
    method getHeaders (line 178) | protected static function getHeaders(array $event)
    method getRequestBody (line 200) | protected static function getRequestBody(array $event)
    method ensureContentTypeIsSet (line 217) | protected static function ensureContentTypeIsSet(array $event, array $...
    method ensureContentLengthIsSet (line 240) | protected static function ensureContentLengthIsSet(array $event, array...
    method ensureSourceIpAddressIsSet (line 261) | protected static function ensureSourceIpAddressIsSet(array $event, arr...
    method extractRequestTimestamp (line 280) | protected static function extractRequestTimestamp(array $event)

FILE: src/Runtime/Response.php
  class Response (line 5) | class Response
    method __construct (line 36) | public function __construct($body, $headers, $status)
    method prepareHeaders (line 50) | protected function prepareHeaders(array $headers)

FILE: src/Runtime/Secrets.php
  class Secrets (line 7) | class Secrets
    method addToEnvironment (line 17) | public static function addToEnvironment($path, $parameters, $file)
    method all (line 37) | public static function all($path, array $parameters = [])
    method parseSecrets (line 67) | protected static function parseSecrets(array $secrets)

FILE: src/Runtime/StorageDirectories.php
  class StorageDirectories (line 5) | class StorageDirectories
    method create (line 19) | public static function create()

FILE: src/Vapor.php
  class Vapor (line 5) | class Vapor
    method active (line 12) | public static function active(): bool
    method inactive (line 20) | public static function inactive(): bool
    method whenActive (line 32) | public static function whenActive($whenActive, $whenInactive = null)
    method whenInactive (line 48) | public static function whenInactive($whenInactive, $whenActive = null)

FILE: src/VaporJobTimedOutException.php
  class VaporJobTimedOutException (line 8) | class VaporJobTimedOutException extends Exception
    method __construct (line 16) | public function __construct($name, ?Throwable $previous = null)

FILE: src/VaporServiceProvider.php
  class VaporServiceProvider (line 21) | class VaporServiceProvider extends ServiceProvider
    method boot (line 30) | public function boot()
    method queueExtender (line 53) | protected function queueExtender()
    method register (line 67) | public function register()
    method configure (line 93) | protected function configure()
    method offerPublishing (line 105) | protected function offerPublishing()
    method ensureMixIsConfigured (line 119) | protected function ensureMixIsConfigured()
    method configureTrustedProxy (line 131) | private function configureTrustedProxy()
    method registerMiddleware (line 141) | protected function registerMiddleware()
    method registerCommands (line 153) | protected function registerCommands()
    method registerOctaneCommands (line 191) | protected function registerOctaneCommands()

FILE: src/debug.php
  function __vapor_debug (line 4) | function __vapor_debug($message)

FILE: tests/Feature/ApiGatewayOctaneHandlerTest.php
  class ApiGatewayOctaneHandlerTest (line 22) | class ApiGatewayOctaneHandlerTest extends TestCase
    method setUp (line 24) | protected function setUp(): void
    method tearDown (line 40) | protected function tearDown(): void
    method test_response_body (line 53) | public function test_response_body()
    method test_invalid_uri (line 68) | public function test_invalid_uri()
    method test_response_file (line 84) | public function test_response_file()
    method test_response_download (line 103) | public function test_response_download()
    method test_response_fires_events (line 120) | public function test_response_fires_events()
    method test_response_headers (line 140) | public function test_response_headers()
    method test_response_status (line 158) | public function test_response_status()
    method test_each_request_have_its_own_app (line 173) | public function test_each_request_have_its_own_app()
    method test_response_cookies (line 203) | public function test_response_cookies()
    method test_robots_header_is_set (line 221) | public function test_robots_header_is_set()
    method test_maintenance_mode (line 241) | public function test_maintenance_mode()
    method test_request_body (line 264) | public function test_request_body()
    method test_request_form_url_encoded_without_inline_input_method (line 290) | public function test_request_form_url_encoded_without_inline_input_met...
    method test_request_cookies (line 315) | public function test_request_cookies()
    method test_request_ignores_invalid_cookies (line 337) | public function test_request_ignores_invalid_cookies()
    method test_request_file_uploads (line 359) | public function test_request_file_uploads()
    method test_request_file_uploads_without_inline_input_method (line 407) | public function test_request_file_uploads_without_inline_input_method()
    method test_request_query_string (line 450) | public function test_request_query_string()
    method test_request_query_params (line 473) | public function test_request_query_params()
    method test_request_headers (line 499) | public function test_request_headers()
    method test_request_multi_headers (line 520) | public function test_request_multi_headers()
    method test_maintenance_mode_with_valid_bypass_cookie (line 543) | public function test_maintenance_mode_with_valid_bypass_cookie()
    method test_maintenance_mode_with_invalid_bypass_cookie (line 582) | public function test_maintenance_mode_with_invalid_bypass_cookie()
    method test_streamed_responses (line 606) | public function test_streamed_responses()

FILE: tests/Feature/Commands/OctaneStatusCommandTest.php
  class OctaneStatusCommandTest (line 11) | class OctaneStatusCommandTest extends TestCase
    method setUp (line 13) | protected function setUp(): void
    method test_when_octane_is_not_running (line 20) | public function test_when_octane_is_not_running()
    method test_when_octane_is_running (line 27) | public function test_when_octane_is_running()
    method tearDown (line 36) | protected function tearDown(): void

FILE: tests/Feature/EnsureOnNakedDomainTest.php
  class EnsureOnNakedDomainTest (line 11) | class EnsureOnNakedDomainTest extends TestCase
    method setUp (line 13) | protected function setUp(): void
    method getPackageProviders (line 24) | protected function getPackageProviders($app): array
    method test_redirects (line 31) | #[DataProvider('useCases')]
    method useCases (line 46) | public static function useCases()

FILE: tests/Feature/LambdaProxyOctaneHandlerTest.php
  class LambdaProxyOctaneHandlerTest (line 21) | class LambdaProxyOctaneHandlerTest extends TestCase
    method setUp (line 23) | protected function setUp(): void
    method tearDown (line 39) | protected function tearDown(): void
    method test_response_body (line 52) | public function test_response_body()
    method test_invalid_uri (line 72) | public function test_invalid_uri()
    method test_response_file (line 93) | public function test_response_file()
    method test_response_download (line 117) | public function test_response_download()
    method test_response_fires_events (line 138) | public function test_response_fires_events()
    method test_response_headers (line 163) | public function test_response_headers()
    method test_response_status (line 186) | public function test_response_status()
    method test_each_request_have_its_own_app (line 206) | public function test_each_request_have_its_own_app()
    method test_response_cookies (line 246) | public function test_response_cookies()
    method test_robots_header_is_set (line 269) | public function test_robots_header_is_set()
    method test_maintenance_mode (line 294) | public function test_maintenance_mode()
    method test_request_body (line 322) | public function test_request_body()
    method test_request_form_url_encoded_without_inline_input_method (line 353) | public function test_request_form_url_encoded_without_inline_input_met...
    method test_request_cookies (line 383) | public function test_request_cookies()
    method test_request_ignores_invalid_cookies (line 410) | public function test_request_ignores_invalid_cookies()
    method test_request_file_uploads (line 438) | public function test_request_file_uploads()
    method test_request_file_uploads_without_inline_input_method (line 491) | public function test_request_file_uploads_without_inline_input_method()
    method test_request_query_string (line 539) | public function test_request_query_string()
    method test_request_query_params (line 567) | public function test_request_query_params()
    method test_request_headers (line 598) | public function test_request_headers()
    method test_request_multi_headers (line 625) | public function test_request_multi_headers()
    method test_maintenance_mode_with_valid_bypass_cookie (line 653) | public function test_maintenance_mode_with_valid_bypass_cookie()
    method test_maintenance_mode_with_invalid_bypass_cookie (line 697) | public function test_maintenance_mode_with_invalid_bypass_cookie()

FILE: tests/Feature/LoadBalancedOctaneHandlerTest.php
  class LoadBalancedOctaneHandlerTest (line 22) | class LoadBalancedOctaneHandlerTest extends TestCase
    method setUp (line 24) | protected function setUp(): void
    method tearDown (line 40) | protected function tearDown(): void
    method test_response_body (line 53) | public function test_response_body()
    method test_invalid_uri (line 68) | public function test_invalid_uri()
    method test_response_fires_events (line 84) | public function test_response_fires_events()
    method test_response_file (line 104) | public function test_response_file()
    method test_response_download (line 123) | public function test_response_download()
    method test_response_headers (line 140) | public function test_response_headers()
    method test_response_status (line 158) | public function test_response_status()
    method test_each_response_have_its_own_app (line 173) | public function test_each_response_have_its_own_app()
    method test_response_cookies (line 203) | public function test_response_cookies()
    method test_robots_header_is_set (line 221) | public function test_robots_header_is_set()
    method test_maintenance_mode (line 239) | public function test_maintenance_mode()
    method test_request_body (line 262) | public function test_request_body()
    method test_request_form_url_encoded_without_inline_input_method (line 288) | public function test_request_form_url_encoded_without_inline_input_met...
    method test_request_file_uploads (line 313) | public function test_request_file_uploads()
    method test_request_file_uploads_without_inline_input_method (line 361) | public function test_request_file_uploads_without_inline_input_method()
    method test_request_cookies (line 404) | public function test_request_cookies()
    method test_request_ignores_invalid_cookies (line 426) | public function test_request_ignores_invalid_cookies()
    method test_request_query_string (line 448) | public function test_request_query_string()
    method test_request_query_params (line 471) | public function test_request_query_params()
    method test_request_headers (line 497) | public function test_request_headers()
    method test_request_multi_headers (line 518) | public function test_request_multi_headers()
    method test_maintenance_mode_with_valid_bypass_cookie (line 541) | public function test_maintenance_mode_with_valid_bypass_cookie()
    method test_maintenance_mode_with_invalid_bypass_cookie (line 580) | public function test_maintenance_mode_with_invalid_bypass_cookie()
    method test_streamed_responses (line 604) | public function test_streamed_responses()

FILE: tests/Feature/OctaneManageDatabaseSessionsTest.php
  class OctaneManageDatabaseSessionsTest (line 10) | class OctaneManageDatabaseSessionsTest extends TestCase
    method test_it_does_not_throw_when_pdo_connection_has_gone_away (line 12) | public function test_it_does_not_throw_when_pdo_connection_has_gone_aw...
    method test_it_proves_bug_exists_without_fix (line 37) | public function test_it_proves_bug_exists_without_fix()
    method test_it_still_sets_wait_timeout_on_live_connections (line 53) | public function test_it_still_sets_wait_timeout_on_live_connections()
    method test_it_handles_mixed_live_and_stale_connections (line 76) | public function test_it_handles_mixed_live_and_stale_connections()

FILE: tests/Feature/OctaneTest.php
  class OctaneTest (line 20) | class OctaneTest extends TestCase
    method setUp (line 22) | protected function setUp(): void
    method tearDown (line 35) | protected function tearDown(): void
    method test_on_error (line 44) | public function test_on_error()
    method test_server_software (line 73) | public function test_server_software()

FILE: tests/Feature/RedirectStaticAssetsTest.php
  class RedirectStaticAssetsTest (line 10) | class RedirectStaticAssetsTest extends TestCase
    method setUp (line 12) | protected function setUp(): void
    method getPackageProviders (line 23) | protected function getPackageProviders($app): array
    method test_redirects_to_favicon_ico (line 30) | public function test_redirects_to_favicon_ico()

FILE: tests/Feature/SignedStorageUrlEndpointTest.php
  class SignedStorageUrlEndpointTest (line 10) | class SignedStorageUrlEndpointTest extends TestCase
    method getPackageProviders (line 12) | protected function getPackageProviders($app): array
    method test_signed_url_preserves_its_components (line 19) | public function test_signed_url_preserves_its_components(): void
    method test_signed_url_expires_after (line 48) | public function test_signed_url_expires_after(): void

FILE: tests/Feature/VaporJobTest.php
  class VaporJobTest (line 15) | class VaporJobTest extends TestCase
    method setUp (line 17) | protected function setUp(): void
    method getPackageProviders (line 24) | protected function getPackageProviders($app): array
    method test_job_release_attempts_without_cache (line 31) | public function test_job_release_attempts_without_cache()
    method test_job_release_attempts_with_cache (line 62) | public function test_job_release_attempts_with_cache()
    method test_job_attempts_without_cache (line 97) | public function test_job_attempts_without_cache()
    method test_job_attempts_with_cache (line 117) | public function test_job_attempts_with_cache()
    method test_job_attempts_priority (line 137) | public function test_job_attempts_priority()
    method test_job_attempts_when_its_missing_from_payload (line 164) | public function test_job_attempts_when_its_missing_from_payload()
    method test_job_attempts_on_delete (line 178) | public function test_job_attempts_on_delete()
    method test_job_fire_without_cache (line 206) | public function test_job_fire_without_cache()
    method test_job_fire_with_cache (line 246) | public function test_job_fire_with_cache()

FILE: tests/Feature/VaporQueueTest.php
  class VaporQueueTest (line 13) | class VaporQueueTest extends TestCase
    method setUp (line 15) | protected function setUp(): void
    method getPackageProviders (line 22) | protected function getPackageProviders($app): array
    method test_proper_payload_array_is_created (line 29) | public function test_proper_payload_array_is_created()
    method test_queue_pop (line 67) | public function test_queue_pop()

FILE: tests/TestCase.php
  class TestCase (line 10) | abstract class TestCase extends BaseTestCase
    method tearDown (line 12) | protected function tearDown(): void
    method getPackageProviders (line 19) | protected function getPackageProviders($app)

FILE: tests/Unit/FakeJob.php
  class FakeJob (line 5) | class FakeJob
    method handle (line 9) | public function handle()

FILE: tests/Unit/FpmRequestTest.php
  class FpmRequestTest (line 10) | class FpmRequestTest extends TestCase
    method setUp (line 12) | public function setUp(): void
    method tearDown (line 19) | protected function tearDown(): void
    method test_query_string_is_decoded_for_elb_requests (line 24) | public function test_query_string_is_decoded_for_elb_requests()
    method test_api_gateway_headers_are_handled (line 39) | public function test_api_gateway_headers_are_handled()
    method test_api_gateway_v2_headers_are_handled (line 64) | public function test_api_gateway_v2_headers_are_handled()
    method test_api_gateway_v2_query_parameters_are_handled (line 94) | public function test_api_gateway_v2_query_parameters_are_handled()
    method test_load_balancer_headers_are_over_spoofed_headers (line 119) | public function test_load_balancer_headers_are_over_spoofed_headers()
    method test_request_content_length_is_numeric (line 155) | public function test_request_content_length_is_numeric()
    method test_api_gateway_v1_request_time_is_set (line 194) | public function test_api_gateway_v1_request_time_is_set()
    method test_api_gateway_v2_request_time_is_set (line 208) | public function test_api_gateway_v2_request_time_is_set()
    method test_elb_request_time_is_not_set (line 222) | public function test_elb_request_time_is_not_set()

FILE: tests/Unit/HttpKernelTest.php
  class HttpKernelTest (line 12) | class HttpKernelTest extends TestCase
    method tearDown (line 14) | protected function tearDown(): void
    method test_should_send_maintenance_mode_response_when_enabled_and_on_non_vanity_domain (line 19) | public function test_should_send_maintenance_mode_response_when_enable...
    method test_should_send_isbase64encode_on_binary_response (line 34) | public function test_should_send_isbase64encode_on_binary_response()

FILE: tests/Unit/LambdaEventTest.php
  class LambdaEventTest (line 8) | class LambdaEventTest extends TestCase
    method test_to_array (line 10) | public function test_to_array()
    method test_array_access (line 17) | public function test_array_access()
    method getEvent (line 34) | public function getEvent()

FILE: tests/Unit/LoadBalancedLambdaResponseTest.php
  class LoadBalancedLambdaResponseTest (line 8) | class LoadBalancedLambdaResponseTest extends TestCase
    method test_header_values_are_always_strings (line 10) | public function test_header_values_are_always_strings()

FILE: tests/Unit/Logging/JsonFormatterTest.php
  class JsonFormatterTest (line 11) | class JsonFormatterTest extends TestCase
    method tearDown (line 13) | protected function tearDown(): void
    method test_format (line 20) | public function test_format()
    method test_includes_aws_request_id (line 85) | public function test_includes_aws_request_id()
    method test_aws_request_id_may_be_null (line 118) | public function test_aws_request_id_may_be_null()

FILE: tests/Unit/OctaneHttpHandlerFactoryTest.php
  class OctaneHttpHandlerFactoryTest (line 17) | class OctaneHttpHandlerFactoryTest extends TestCase
    method setUp (line 19) | protected function setUp(): void
    method tearDown (line 28) | protected function tearDown(): void
    method test_resolves_warmer (line 35) | public function test_resolves_warmer()
    method test_resolves_warmer_ping (line 44) | public function test_resolves_warmer_ping()
    method test_resolves_octane (line 53) | public function test_resolves_octane()
    method test_resolves_unknown (line 62) | public function test_resolves_unknown()

FILE: tests/Unit/QueueHandlerTest.php
  class QueueHandlerTest (line 10) | class QueueHandlerTest extends TestCase
    method setUp (line 12) | protected function setUp(): void
    method tearDown (line 19) | protected function tearDown(): void
    method test_job_can_be_called (line 25) | public function test_job_can_be_called()
    method getPackageProviders (line 56) | protected function getPackageProviders($app)
    method getEnvironmentSetUp (line 63) | protected function getEnvironmentSetUp($app)
    method getEvent (line 78) | protected function getEvent()

FILE: tests/Unit/Runtime/CliHandlerFactoryTest.php
  class CliHandlerFactoryTest (line 10) | class CliHandlerFactoryTest extends TestCase
    method setUp (line 12) | protected function setUp(): void
    method tearDown (line 19) | protected function tearDown(): void
    method test_custom_sqs_events_use_cli_handler (line 26) | public function test_custom_sqs_events_use_cli_handler()
    method test_custom_non_sqs_lambda_events_use_cli_handler (line 31) | public function test_custom_non_sqs_lambda_events_use_cli_handler()
    method test_laravel_jobs_use_queue_handler (line 36) | public function test_laravel_jobs_use_queue_handler()
    method test_custom_handler_factory_is_used_when_set (line 41) | public function test_custom_handler_factory_is_used_when_set()
    method test_custom_handler_factory_receives_event (line 50) | public function test_custom_handler_factory_receives_event()
    method test_default_behavior_is_restored_after_reset (line 66) | public function test_default_behavior_is_restored_after_reset()
    method getCustomNonSQSLambdaEvent (line 77) | protected function getCustomNonSQSLambdaEvent()
    method getSQSJobEvent (line 85) | protected function getSQSJobEvent()
    method getSQSCustomEvent (line 93) | protected function getSQSCustomEvent()

FILE: tests/Unit/VaporConnectorTest.php
  class VaporConnectorTest (line 9) | class VaporConnectorTest extends TestCase
    method test_can_create_vapor_queue (line 11) | public function test_can_create_vapor_queue()

FILE: tests/Unit/VaporScheduleCommandTest.php
  class VaporScheduleCommandTest (line 13) | class VaporScheduleCommandTest extends TestCase
    method setUp (line 15) | protected function setUp(): void
    method getPackageProviders (line 26) | protected function getPackageProviders($app): array
    method test_scheduler_is_invoked_when_invalid_cache_is_configured (line 33) | public function test_scheduler_is_invoked_when_invalid_cache_is_config...
    method test_scheduler_is_called_at_the_top_of_the_minute (line 55) | public function test_scheduler_is_called_at_the_top_of_the_minute()
    method test_scheduler_is_not_invoked_if_lock_cannot_be_obtained (line 72) | public function test_scheduler_is_not_invoked_if_lock_cannot_be_obtain...

FILE: tests/Unit/VaporTest.php
  class VaporTest (line 8) | class VaporTest extends TestCase
    method setUp (line 10) | protected function setUp(): void
    method test_vapor_active (line 17) | public function test_vapor_active()
    method test_vapor_inactive (line 24) | public function test_vapor_inactive()
    method test_vapor_when_active (line 29) | public function test_vapor_when_active()
    method test_vapor_when_active_with_callback (line 36) | public function test_vapor_when_active_with_callback()
    method test_vapor_when_inactive (line 45) | public function test_vapor_when_inactive()
    method test_vapor_when_inactive_with_callback (line 50) | public function test_vapor_when_inactive_with_callback()

FILE: tests/Unit/VaporWorkCommandTest.php
  class VaporWorkCommandTest (line 9) | class VaporWorkCommandTest extends TestCase
    method setUp (line 11) | protected function setUp(): void
    method tearDown (line 18) | protected function tearDown(): void
    method test_command_can_be_called (line 24) | public function test_command_can_be_called()
    method getPackageProviders (line 52) | protected function getPackageProviders($app)
    method getEnvironmentSetUp (line 59) | protected function getEnvironmentSetUp($app)
    method getEvent (line 74) | protected function getEvent()
Condensed preview — 130 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (509K chars).
[
  {
    "path": ".editorconfig",
    "chars": 220,
    "preview": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 4\ntrim_"
  },
  {
    "path": ".gitattributes",
    "chars": 463,
    "preview": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and"
  },
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "chars": 148,
    "preview": "# Code of Conduct\n\nThe Laravel Code of Conduct can be found in the [Laravel documentation](https://laravel.com/docs/cont"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 138,
    "preview": "# Contribution Guide\n\nThe Laravel contributing guide can be found in the [Laravel documentation](https://laravel.com/doc"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 520,
    "preview": "<!--\nPlease only send a pull request to branches which are currently supported: https://laravel.com/docs/releases#suppor"
  },
  {
    "path": ".github/SECURITY.md",
    "chars": 5114,
    "preview": "# Security Policy\n\n**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**\n"
  },
  {
    "path": ".github/SUPPORT.md",
    "chars": 150,
    "preview": "# Support Questions\n\nThe Laravel support guide can be found in the [Laravel documentation](https://laravel.com/docs/cont"
  },
  {
    "path": ".github/workflows/static-analysis.yml",
    "chars": 210,
    "preview": "name: static analysis\n\non:\n  push:\n    branches:\n      - master\n      - '*.x'\n  pull_request:\n\npermissions:\n  contents: "
  },
  {
    "path": ".github/workflows/tests.yml",
    "chars": 1481,
    "preview": "name: tests\n\non:\n  push:\n  pull_request:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  tests:\n    runs-on: ubuntu-22.04\n\n"
  },
  {
    "path": ".github/workflows/update-changelog.yml",
    "chars": 187,
    "preview": "name: update changelog\n\non:\n  release:\n    types: [released]\n\njobs:\n  update:\n    permissions:\n      contents: write\n   "
  },
  {
    "path": ".gitignore",
    "chars": 80,
    "preview": ".env\n.phpunit.result.cache\nphpunit.xml\nbuild\ncomposer.lock\ndocs\nvendor\ncoverage\n"
  },
  {
    "path": ".styleci.yml",
    "chars": 66,
    "preview": "preset: laravel\n\ndisabled:\n  - single_class_element_per_statement\n"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 3866,
    "preview": "# Release Notes\n\n## [Unreleased](https://github.com/laravel/vapor-core/compare/v2.43.3...2.0)\n\n## [v2.43.3](https://gith"
  },
  {
    "path": "LICENSE.md",
    "chars": 1096,
    "preview": "The MIT License (MIT)\n\nCopyright (c) Taylor Otwell <taylor@laravel.com>\n\nPermission is hereby granted, free of charge, t"
  },
  {
    "path": "README.md",
    "chars": 1373,
    "preview": "# Laravel Vapor Core / Runtime\n\n<p>\n<a href=\"https://github.com/laravel/vapor-core/actions\"><img src=\"https://github.com"
  },
  {
    "path": "composer.json",
    "chars": 2151,
    "preview": "{\n    \"name\": \"laravel/vapor-core\",\n    \"description\": \"The kernel and invocation handlers for Laravel Vapor\",\n    \"keyw"
  },
  {
    "path": "config/vapor.php",
    "chars": 1432,
    "preview": "<?php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Redirect \""
  },
  {
    "path": "phpstan.neon.dist",
    "chars": 146,
    "preview": "parameters:\n  paths:\n    - config\n    - src\n\n  level: 0\n\n  ignoreErrors:\n    - \"#Unsafe usage of new static\\\\(\\\\)#\"\n    "
  },
  {
    "path": "phpunit.xml.dist",
    "chars": 885,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit bootstrap=\"vendor/autoload.php\"\n         backupGlobals=\"false\"\n         "
  },
  {
    "path": "src/Arr.php",
    "chars": 3318,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\n/*\nThe MIT License (MIT)\n\nCopyright (c) 2018 Matthieu Napoli\n\nPermission is hereby gran"
  },
  {
    "path": "src/ConfiguresAssets.php",
    "chars": 632,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Support\\Facades\\Config;\n\ntrait ConfiguresAssets\n{\n    /**\n     * Ensure "
  },
  {
    "path": "src/ConfiguresDynamoDb.php",
    "chars": 848,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Support\\Facades\\Config;\n\ntrait ConfiguresDynamoDb\n{\n    /**\n     * Ensur"
  },
  {
    "path": "src/ConfiguresQueue.php",
    "chars": 1245,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Cache\\NullStore;\nuse Illuminate\\Cache\\Repository;\nuse Illuminate\\Contrac"
  },
  {
    "path": "src/ConfiguresRedis.php",
    "chars": 1645,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\Facades\\Config;\n\ntrait ConfiguresRed"
  },
  {
    "path": "src/ConfiguresSqs.php",
    "chars": 810,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Support\\Facades\\Config;\n\ntrait ConfiguresSqs\n{\n    /**\n     * Ensure SQS"
  },
  {
    "path": "src/Console/Commands/OctaneStatusCommand.php",
    "chars": 895,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\n\nclass OctaneStatusCommand extends Com"
  },
  {
    "path": "src/Console/Commands/VaporHealthCheckCommand.php",
    "chars": 1705,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\"
  },
  {
    "path": "src/Console/Commands/VaporQueueListFailedCommand.php",
    "chars": 5482,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Carbon\\Carbon;\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Queu"
  },
  {
    "path": "src/Console/Commands/VaporScheduleCommand.php",
    "chars": 2211,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Contracts\\Cache\\Reposit"
  },
  {
    "path": "src/Console/Commands/VaporWorkCommand.php",
    "chars": 5460,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Queue\\Events\\JobFailed;"
  },
  {
    "path": "src/Console/Commands/WritesQueueEventMessages.php",
    "chars": 1923,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Console\\Commands;\n\nuse Illuminate\\Contracts\\Queue\\Job;\nuse Illuminate\\Queue\\Events\\JobFai"
  },
  {
    "path": "src/Contracts/LambdaEventHandler.php",
    "chars": 265,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Contracts;\n\ninterface LambdaEventHandler\n{\n    /**\n     * Handle an incoming Lambda event"
  },
  {
    "path": "src/Contracts/LambdaResponse.php",
    "chars": 221,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Contracts;\n\ninterface LambdaResponse\n{\n    /**\n     * Convert the response to API Gateway"
  },
  {
    "path": "src/Contracts/SignedStorageUrlController.php",
    "chars": 305,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Contracts;\n\nuse Illuminate\\Http\\Request;\n\ninterface SignedStorageUrlController\n{\n    /**\n"
  },
  {
    "path": "src/DefinesRoutes.php",
    "chars": 635,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Support\\Facades\\Route;\n\ntrait DefinesRoutes\n{\n    /**\n     * Ensure that"
  },
  {
    "path": "src/Events/LambdaEvent.php",
    "chars": 1632,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Events;\n\nuse ArrayAccess;\nuse Illuminate\\Contracts\\Support\\Arrayable;\nuse Illuminate\\Supp"
  },
  {
    "path": "src/HasAwsContext.php",
    "chars": 2009,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\ntrait HasAwsContext\n{\n    /**\n     * Get the current AWS request ID.\n     *\n     * @ret"
  },
  {
    "path": "src/Http/Controllers/SignedStorageUrlController.php",
    "chars": 5159,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Http\\Controllers;\n\nuse Aws\\S3\\S3Client;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Routi"
  },
  {
    "path": "src/Http/Middleware/ServeStaticAssets.php",
    "chars": 1278,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Http\\Middleware;\n\nuse Closure;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\ClientExce"
  },
  {
    "path": "src/Logging/JsonFormatter.php",
    "chars": 878,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Logging;\n\nuse Monolog\\Formatter\\JsonFormatter as BaseJsonFormatter;\nuse Monolog\\LogRecord"
  },
  {
    "path": "src/Queue/JobAttempts.php",
    "chars": 2533,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Queue;\n\nuse Illuminate\\Contracts\\Cache\\Repository as Cache;\nuse Illuminate\\Contracts\\Queu"
  },
  {
    "path": "src/Queue/VaporConnector.php",
    "chars": 1218,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Queue;\n\nuse Aws\\Sqs\\SqsClient;\nuse Illuminate\\Queue\\Connectors\\ConnectorInterface;\nuse Il"
  },
  {
    "path": "src/Queue/VaporJob.php",
    "chars": 1416,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Queue;\n\nuse Illuminate\\Queue\\Jobs\\SqsJob;\n\nclass VaporJob extends SqsJob\n{\n    /**\n     *"
  },
  {
    "path": "src/Queue/VaporQueue.php",
    "chars": 1299,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Queue;\n\nuse Illuminate\\Queue\\SqsQueue;\n\nclass VaporQueue extends SqsQueue\n{\n    /**\n     "
  },
  {
    "path": "src/Queue/VaporWorker.php",
    "chars": 937,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Queue;\n\nuse Illuminate\\Queue\\Worker;\nuse Illuminate\\Queue\\WorkerOptions;\nuse Laravel\\Vapo"
  },
  {
    "path": "src/Runtime/ArrayLambdaResponse.php",
    "chars": 641,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Laravel\\Vapor\\Contracts\\LambdaResponse;\n\nclass ArrayLambdaResponse implemen"
  },
  {
    "path": "src/Runtime/CliHandlerFactory.php",
    "chars": 1338,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Laravel\\Vapor\\Runtime\\Handlers\\CliHandler;\nuse Laravel\\Vapor\\Runtime\\Handle"
  },
  {
    "path": "src/Runtime/Environment.php",
    "chars": 3990,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Dotenv\\Dotenv;\nuse Illuminate\\Contracts\\Console\\Kernel;\nuse Illuminate\\Cont"
  },
  {
    "path": "src/Runtime/Fpm/ActsAsFastCgiDataProvider.php",
    "chars": 2809,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\ntrait ActsAsFastCgiDataProvider\n{\n    /**\n     * {@inheritdoc}\n     */\n    "
  },
  {
    "path": "src/Runtime/Fpm/Fpm.php",
    "chars": 7572,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nuse Exception;\nuse hollodotme\\FastCGI\\Client;\nuse hollodotme\\FastCGI\\Socket"
  },
  {
    "path": "src/Runtime/Fpm/FpmApplication.php",
    "chars": 1193,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nuse hollodotme\\FastCGI\\Client;\nuse hollodotme\\FastCGI\\SocketConnections\\Uni"
  },
  {
    "path": "src/Runtime/Fpm/FpmHttpHandlerFactory.php",
    "chars": 1241,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nuse Laravel\\Vapor\\Runtime\\Handlers\\FpmHandler;\nuse Laravel\\Vapor\\Runtime\\Ha"
  },
  {
    "path": "src/Runtime/Fpm/FpmRequest.php",
    "chars": 239,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nuse hollodotme\\FastCGI\\Interfaces\\ProvidesRequestData;\nuse Laravel\\Vapor\\Ru"
  },
  {
    "path": "src/Runtime/Fpm/FpmResponse.php",
    "chars": 973,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nuse hollodotme\\FastCGI\\Interfaces\\ProvidesResponseData;\nuse Laravel\\Vapor\\R"
  },
  {
    "path": "src/Runtime/Fpm/FpmResponseHeaders.php",
    "chars": 570,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Fpm;\n\nclass FpmResponseHeaders\n{\n    /**\n     * Extract the response headers from"
  },
  {
    "path": "src/Runtime/Handlers/CliHandler.php",
    "chars": 2167,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse GuzzleHttp\\Client;\nuse Illuminate\\Support\\Str;\nuse Laravel\\Vapor\\C"
  },
  {
    "path": "src/Runtime/Handlers/FpmHandler.php",
    "chars": 1538,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Contracts\\LambdaEventHandler;\nuse Laravel\\Vapor\\Runt"
  },
  {
    "path": "src/Runtime/Handlers/LoadBalancedFpmHandler.php",
    "chars": 555,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Runtime\\LoadBalancedLambdaResponse;\n\nclass LoadBalan"
  },
  {
    "path": "src/Runtime/Handlers/LoadBalancedOctaneHandler.php",
    "chars": 561,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Runtime\\LoadBalancedLambdaResponse;\n\nclass LoadBalan"
  },
  {
    "path": "src/Runtime/Handlers/OctaneHandler.php",
    "chars": 1616,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Octane\\MarshalsPsr7RequestsAndResponses;\nuse Laravel\\Vapor"
  },
  {
    "path": "src/Runtime/Handlers/PayloadFormatVersion2FpmHandler.php",
    "chars": 648,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Contracts\\LambdaEventHandler;\nuse Laravel\\Vapor\\Runt"
  },
  {
    "path": "src/Runtime/Handlers/PayloadFormatVersion2OctaneHandler.php",
    "chars": 657,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Contracts\\LambdaEventHandler;\nuse Laravel\\Vapor\\Runt"
  },
  {
    "path": "src/Runtime/Handlers/QueueHandler.php",
    "chars": 2735,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Illuminate\\Contracts\\Console\\Kernel;\nuse Laravel\\Vapor\\Contracts\\L"
  },
  {
    "path": "src/Runtime/Handlers/UnknownEventHandler.php",
    "chars": 654,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Contracts\\LambdaEventHandler;\nuse Laravel\\Vapor\\Runt"
  },
  {
    "path": "src/Runtime/Handlers/WarmerHandler.php",
    "chars": 1934,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Aws\\Lambda\\LambdaClient;\nuse GuzzleHttp\\Promise\\Utils;\nuse Laravel"
  },
  {
    "path": "src/Runtime/Handlers/WarmerPingHandler.php",
    "chars": 533,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Handlers;\n\nuse Laravel\\Vapor\\Contracts\\LambdaEventHandler;\nuse Laravel\\Vapor\\Runt"
  },
  {
    "path": "src/Runtime/Http/Middleware/EnsureBinaryEncoding.php",
    "chars": 1099,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Http\\Middleware;\n\nuse Illuminate\\Support\\Str;\nuse Symfony\\Component\\HttpFoundatio"
  },
  {
    "path": "src/Runtime/Http/Middleware/EnsureOnNakedDomain.php",
    "chars": 1301,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Http\\Middleware;\n\nuse Illuminate\\Http\\RedirectResponse;\nuse Illuminate\\Support\\St"
  },
  {
    "path": "src/Runtime/Http/Middleware/EnsureVanityUrlIsNotIndexed.php",
    "chars": 545,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Http\\Middleware;\n\nclass EnsureVanityUrlIsNotIndexed\n{\n    /**\n     * Handle the i"
  },
  {
    "path": "src/Runtime/Http/Middleware/RedirectStaticAssets.php",
    "chars": 891,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Http\\Middleware;\n\nuse Illuminate\\Http\\RedirectResponse;\n\nclass RedirectStaticAsse"
  },
  {
    "path": "src/Runtime/HttpKernel.php",
    "chars": 5822,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Illuminate\\Contracts\\Http\\Kernel as HttpKernelContract;\nuse Illuminate\\Foun"
  },
  {
    "path": "src/Runtime/LambdaContainer.php",
    "chars": 852,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Laravel\\Vapor\\Runtime\\Octane\\Octane;\n\nclass LambdaContainer\n{\n    /**\n     "
  },
  {
    "path": "src/Runtime/LambdaInvocation.php",
    "chars": 2314,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Exception;\n\nclass LambdaInvocation\n{\n    /**\n     * The cached curl handler"
  },
  {
    "path": "src/Runtime/LambdaResponse.php",
    "chars": 4201,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Laravel\\Vapor\\Contracts\\LambdaResponse as LambdaResponseContract;\nuse stdCl"
  },
  {
    "path": "src/Runtime/LambdaRuntime.php",
    "chars": 2017,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Exception;\nuse Throwable;\n\nclass LambdaRuntime\n{\n    use NotifiesLambda;\n\n "
  },
  {
    "path": "src/Runtime/LoadBalancedLambdaResponse.php",
    "chars": 1999,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Symfony\\Component\\HttpFoundation\\Response as SymfonyResponse;\n\nclass LoadBa"
  },
  {
    "path": "src/Runtime/Logger.php",
    "chars": 1299,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Monolog\\Formatter\\JsonFormatter;\nuse Monolog\\Handler\\StreamHandler;\nuse Mon"
  },
  {
    "path": "src/Runtime/NotifiesLambda.php",
    "chars": 2216,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Exception;\n\ntrait NotifiesLambda\n{\n    /**\n     * Send the response data to"
  },
  {
    "path": "src/Runtime/Octane/Octane.php",
    "chars": 9852,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Octane;\n\nuse Illuminate\\Contracts\\Debug\\ExceptionHandler;\nuse Illuminate\\Database"
  },
  {
    "path": "src/Runtime/Octane/OctaneHttpHandlerFactory.php",
    "chars": 1265,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Octane;\n\nuse Laravel\\Vapor\\Runtime\\Handlers\\LoadBalancedOctaneHandler;\nuse Larave"
  },
  {
    "path": "src/Runtime/Octane/OctaneRequestContextFactory.php",
    "chars": 6628,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime\\Octane;\n\nuse Illuminate\\Support\\Arr as SupportArr;\nuse Illuminate\\Support\\Collect"
  },
  {
    "path": "src/Runtime/PayloadFormatVersion2LambdaResponse.php",
    "chars": 1559,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Laravel\\Vapor\\Contracts\\LambdaResponse as LambdaResponseContract;\nuse stdCl"
  },
  {
    "path": "src/Runtime/Request.php",
    "chars": 9346,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Illuminate\\Support\\Arr;\n\nclass Request\n{\n    /**\n     * The request server "
  },
  {
    "path": "src/Runtime/Response.php",
    "chars": 1004,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nclass Response\n{\n    /**\n     * The response status code.\n     *\n     * @var in"
  },
  {
    "path": "src/Runtime/Secrets.php",
    "chars": 2094,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nuse Aws\\Ssm\\SsmClient;\n\nclass Secrets\n{\n    /**\n     * Add all of the secret pa"
  },
  {
    "path": "src/Runtime/StorageDirectories.php",
    "chars": 851,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Runtime;\n\nclass StorageDirectories\n{\n    /**\n     * The storage path for the execution en"
  },
  {
    "path": "src/Vapor.php",
    "chars": 1106,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nclass Vapor\n{\n    use HasAwsContext;\n\n    /**\n     * Determine whether the environment "
  },
  {
    "path": "src/VaporJobTimedOutException.php",
    "chars": 425,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Exception;\nuse Throwable;\n\nclass VaporJobTimedOutException extends Exception\n{\n    "
  },
  {
    "path": "src/VaporServiceProvider.php",
    "chars": 5472,
    "preview": "<?php\n\nnamespace Laravel\\Vapor;\n\nuse Illuminate\\Contracts\\Console\\Kernel as ConsoleKernel;\nuse Illuminate\\Contracts\\Http"
  },
  {
    "path": "src/debug.php",
    "chars": 234,
    "preview": "<?php\n\nif (! function_exists('__vapor_debug')) {\n    function __vapor_debug($message)\n    {\n        if (isset($_ENV['VAP"
  },
  {
    "path": "stubs/503.html",
    "chars": 1591,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <meta name=\"viewport\" content=\"width="
  },
  {
    "path": "stubs/cliRuntime.php",
    "chars": 3147,
    "preview": "<?php\n\nuse Illuminate\\Contracts\\Console\\Kernel as ConsoleKernelContract;\nuse Laravel\\Vapor\\Runtime\\CliHandlerFactory;\nus"
  },
  {
    "path": "stubs/fpmRuntime.php",
    "chars": 4043,
    "preview": "<?php\n\nuse hollodotme\\FastCGI\\Exceptions\\WriteFailedException;\nuse Illuminate\\Contracts\\Console\\Kernel as ConsoleKernelC"
  },
  {
    "path": "stubs/httpHandler.php",
    "chars": 1760,
    "preview": "<?php\n\nuse Illuminate\\Http\\Request;\nuse Laravel\\Vapor\\Runtime\\HttpKernel;\n\n/**\n * Laravel - A PHP Framework For Web Arti"
  },
  {
    "path": "stubs/httpRuntime.php",
    "chars": 67,
    "preview": "<?php\n\n// This file exists for backwards compatibility purposes...\n"
  },
  {
    "path": "stubs/octaneRuntime.php",
    "chars": 3589,
    "preview": "<?php\n\nuse Illuminate\\Contracts\\Console\\Kernel as ConsoleKernelContract;\nuse Laravel\\Vapor\\Runtime\\Environment;\nuse Lara"
  },
  {
    "path": "stubs/php-fpm.conf",
    "chars": 239,
    "preview": "error_log = /dev/null\npid = /tmp/.vapor/php-fpm.pid\nlog_limit= 10000\n\n[default]\npm = static\npm.max_children = 2\npm.max_r"
  },
  {
    "path": "stubs/rds-combined-ca-bundle.pem",
    "chars": 184667,
    "preview": "-----BEGIN CERTIFICATE-----\nMIIEEjCCAvqgAwIBAgIJAM2ZN/+nPi27MA0GCSqGSIb3DQEBCwUAMIGVMQswCQYD\nVQQGEwJVUzEQMA4GA1UEBwwHU2V"
  },
  {
    "path": "stubs/runtime-with-vendor-download.php",
    "chars": 1530,
    "preview": "<?php\n\nini_set('display_errors', '1');\n\nerror_reporting(E_ALL);\n\nif (! file_exists('/tmp/opcache')) {\n    mkdir('/tmp/op"
  },
  {
    "path": "stubs/runtime.php",
    "chars": 963,
    "preview": "<?php\n\nini_set('display_errors', '1');\n\nerror_reporting(E_ALL);\n\nif (! file_exists('/tmp/opcache')) {\n    mkdir('/tmp/op"
  },
  {
    "path": "tests/Feature/ApiGatewayOctaneHandlerTest.php",
    "chars": 18220,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nif (! interface_exists(\\Laravel\\Octane\\Contracts\\Client::class)) {\n    re"
  },
  {
    "path": "tests/Feature/Commands/OctaneStatusCommandTest.php",
    "chars": 968,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature\\Commands;\n\nif (! interface_exists(\\Laravel\\Octane\\Contracts\\Client::class))"
  },
  {
    "path": "tests/Feature/EnsureOnNakedDomainTest.php",
    "chars": 4314,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nuse Illuminate\\Support\\Facades\\Route;\nuse Laravel\\Vapor\\Runtime\\Http\\Midd"
  },
  {
    "path": "tests/Feature/LambdaProxyOctaneHandlerTest.php",
    "chars": 20815,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nif (! interface_exists(\\Laravel\\Octane\\Contracts\\Client::class)) {\n    re"
  },
  {
    "path": "tests/Feature/LoadBalancedOctaneHandlerTest.php",
    "chars": 18633,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nif (! interface_exists(\\Laravel\\Octane\\Contracts\\Client::class)) {\n    re"
  },
  {
    "path": "tests/Feature/OctaneManageDatabaseSessionsTest.php",
    "chars": 3371,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nuse Laravel\\Vapor\\Tests\\TestCase;\nuse Mockery;\nuse PDO;\nuse PDOException;"
  },
  {
    "path": "tests/Feature/OctaneTest.php",
    "chars": 2042,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nif (! interface_exists(\\Laravel\\Octane\\Contracts\\Client::class)) {\n    re"
  },
  {
    "path": "tests/Feature/RedirectStaticAssetsTest.php",
    "chars": 1062,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nuse Illuminate\\Support\\Facades\\Route;\nuse Laravel\\Vapor\\Runtime\\Http\\Midd"
  },
  {
    "path": "tests/Feature/SignedStorageUrlEndpointTest.php",
    "chars": 2955,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nuse Illuminate\\Support\\Facades\\Config;\nuse Illuminate\\Support\\Facades\\Gat"
  },
  {
    "path": "tests/Feature/VaporJobTest.php",
    "chars": 9096,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Feature;\n\nuse Aws\\Result;\nuse Aws\\Sqs\\SqsClient;\nuse Illuminate\\Cache\\ArrayStore;\nu"
  },
  {
    "path": "tests/Feature/VaporQueueTest.php",
    "chars": 2521,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Aws\\Sqs\\SqsClient;\nuse Illuminate\\Cache\\ArrayStore;\nuse Laravel\\Vapor\\Qu"
  },
  {
    "path": "tests/Fixtures/503.json",
    "chars": 60,
    "preview": "{\n    \"message\": \"We are currently down for maintenance.\"\n}\n"
  },
  {
    "path": "tests/Fixtures/asset.js",
    "chars": 15,
    "preview": "console.log();\n"
  },
  {
    "path": "tests/Fixtures/customLambdaEventFromSQS.json",
    "chars": 1146,
    "preview": "{\n    \"Records\": [\n        {\n            \"messageId\": \"ddccab4e-f6fe-4a9a-aa18-b67ca8724d01\",\n            \"receiptHandle"
  },
  {
    "path": "tests/Fixtures/customNonSQSLambdaEvent.json",
    "chars": 1079,
    "preview": "{\n    \"Records\": [\n        {\n            \"receiptHandle\": \"AQEBq42fiVBuPsL7mSHaAX7JqRNPgx\\/5a1o\\/ku1DFfrowMGI32C+1IHyaF9"
  },
  {
    "path": "tests/Fixtures/jobLambdaEventFromSQS.json",
    "chars": 2720,
    "preview": "{\n   \"Records\":[\n      {\n         \"messageId\":\"58600123-d011-4d76-af5d-960159ca44aa\",\n         \"receiptHandle\":\"AQEBberA"
  },
  {
    "path": "tests/TestCase.php",
    "chars": 514,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests;\n\nuse Laravel\\Octane\\OctaneServiceProvider;\nuse Laravel\\Vapor\\VaporServiceProvider;"
  },
  {
    "path": "tests/Unit/FakeJob.php",
    "chars": 173,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nclass FakeJob\n{\n    public static $handled = false;\n\n    public function han"
  },
  {
    "path": "tests/Unit/FpmRequestTest.php",
    "chars": 7426,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Carbon\\Carbon;\nuse Laravel\\Vapor\\Runtime\\Fpm\\FpmRequest;\nuse Mockery;\nus"
  },
  {
    "path": "tests/Unit/HttpKernelTest.php",
    "chars": 2162,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Http\\Response;\nuse Laravel\\Vapor"
  },
  {
    "path": "tests/Unit/LambdaEventTest.php",
    "chars": 1079,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Events\\LambdaEvent;\nuse PHPUnit\\Framework\\TestCase;\n\nclass"
  },
  {
    "path": "tests/Unit/LoadBalancedLambdaResponseTest.php",
    "chars": 520,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Runtime\\LoadBalancedLambdaResponse;\nuse PHPUnit\\Framework\\"
  },
  {
    "path": "tests/Unit/Logging/JsonFormatterTest.php",
    "chars": 4394,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit\\Logging;\n\nuse Laravel\\Vapor\\Logging\\JsonFormatter;\nuse Mockery;\nuse Monolog\\Le"
  },
  {
    "path": "tests/Unit/OctaneHttpHandlerFactoryTest.php",
    "chars": 1669,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nif (\\PHP_VERSION_ID < 80000) {\n    return;\n}\n\nuse Laravel\\Vapor\\Runtime\\Hand"
  },
  {
    "path": "tests/Unit/QueueHandlerTest.php",
    "chars": 2329,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Events\\LambdaEvent;\nuse Laravel\\Vapor\\Runtime\\Handlers\\Que"
  },
  {
    "path": "tests/Unit/Runtime/CliHandlerFactoryTest.php",
    "chars": 2772,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit\\Runtime;\n\nuse Laravel\\Vapor\\Runtime\\CliHandlerFactory;\nuse Laravel\\Vapor\\Runti"
  },
  {
    "path": "tests/Unit/VaporConnectorTest.php",
    "chars": 633,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Queue\\VaporConnector;\nuse Laravel\\Vapor\\Queue\\VaporQueue;\n"
  },
  {
    "path": "tests/Unit/VaporScheduleCommandTest.php",
    "chars": 3311,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Carbon\\Carbon;\nuse Illuminate\\Cache\\Repository;\nuse Illuminate\\Support\\F"
  },
  {
    "path": "tests/Unit/VaporTest.php",
    "chars": 1309,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Vapor;\nuse Orchestra\\Testbench\\TestCase;\n\nclass VaporTest "
  },
  {
    "path": "tests/Unit/VaporWorkCommandTest.php",
    "chars": 2118,
    "preview": "<?php\n\nnamespace Laravel\\Vapor\\Tests\\Unit;\n\nuse Laravel\\Vapor\\Events\\LambdaEvent;\nuse Mockery;\nuse Orchestra\\Testbench\\T"
  }
]

About this extraction

This page contains the full source code of the laravel/vapor-core GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 130 files (473.9 KB), approximately 195.8k tokens, and a symbol index with 518 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!