├── .github ├── .patch_files ├── .syncignore ├── CODEOWNERS ├── dependabot.yml ├── labels.yml └── workflows │ ├── approve-bot-pr.yml │ ├── create-draft-release.yml │ ├── label-pr.yml │ ├── lint-yaml.yml │ ├── lint.yml │ ├── publish-releases.yml │ ├── push-buildpackage.yml │ ├── synchronize-labels.yml │ ├── test-pull-request.yml │ ├── update-buildpack-toml.yml │ ├── update-github-config.yml │ └── update-go-mod-version.yml ├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── buildpack.toml ├── go.mod ├── go.sum ├── integration.json ├── integration ├── builtin_server_test.go ├── composer_test.go ├── httpd_test.go ├── init_test.go ├── memcached_session_handler_test.go ├── nginx_test.go ├── redis_session_handler_test.go ├── reproducible_builds_test.go ├── stack_upgrade_test.go └── testdata │ ├── ca_cert_apps │ ├── binding │ │ ├── ca.pem │ │ └── type │ ├── httpd_app │ │ ├── .httpd.conf.d │ │ │ └── custom.conf │ │ ├── certs │ │ │ ├── ca.pem │ │ │ ├── cert.pem │ │ │ └── key.pem │ │ └── htdocs │ │ │ └── index.php │ └── nginx_app │ │ ├── .nginx.conf.d │ │ └── user-server.conf │ │ ├── certs │ │ ├── ca.pem │ │ ├── cert.pem │ │ └── key.pem │ │ └── htdocs │ │ └── index.php │ ├── session_handler_apps │ ├── htdocs │ │ └── index.php │ ├── memcached_binding │ │ └── type │ └── redis_binding │ │ └── type │ ├── simple_composer_app │ ├── README.md │ ├── composer.json │ ├── composer.lock │ └── htdocs │ │ └── index.php │ └── vendored_composer_app │ ├── composer.json │ ├── composer.lock │ ├── htdocs │ └── index.php │ └── vendor │ ├── autoload.php │ ├── composer │ ├── ClassLoader.php │ ├── LICENSE │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ ├── autoload_static.php │ └── installed.json │ ├── monolog │ └── monolog │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── composer.json │ │ └── src │ │ └── Monolog │ │ ├── ErrorHandler.php │ │ ├── Formatter │ │ ├── ChromePHPFormatter.php │ │ ├── ElasticaFormatter.php │ │ ├── FlowdockFormatter.php │ │ ├── FluentdFormatter.php │ │ ├── FormatterInterface.php │ │ ├── GelfMessageFormatter.php │ │ ├── HtmlFormatter.php │ │ ├── JsonFormatter.php │ │ ├── LineFormatter.php │ │ ├── LogglyFormatter.php │ │ ├── LogstashFormatter.php │ │ ├── MongoDBFormatter.php │ │ ├── NormalizerFormatter.php │ │ ├── ScalarFormatter.php │ │ └── WildfireFormatter.php │ │ ├── Handler │ │ ├── AbstractHandler.php │ │ ├── AbstractProcessingHandler.php │ │ ├── AbstractSyslogHandler.php │ │ ├── AmqpHandler.php │ │ ├── BrowserConsoleHandler.php │ │ ├── BufferHandler.php │ │ ├── ChromePHPHandler.php │ │ ├── CouchDBHandler.php │ │ ├── CubeHandler.php │ │ ├── Curl │ │ │ └── Util.php │ │ ├── DeduplicationHandler.php │ │ ├── DoctrineCouchDBHandler.php │ │ ├── DynamoDbHandler.php │ │ ├── ElasticSearchHandler.php │ │ ├── ErrorLogHandler.php │ │ ├── FilterHandler.php │ │ ├── FingersCrossed │ │ │ ├── ActivationStrategyInterface.php │ │ │ ├── ChannelLevelActivationStrategy.php │ │ │ └── ErrorLevelActivationStrategy.php │ │ ├── FingersCrossedHandler.php │ │ ├── FirePHPHandler.php │ │ ├── FleepHookHandler.php │ │ ├── FlowdockHandler.php │ │ ├── FormattableHandlerInterface.php │ │ ├── FormattableHandlerTrait.php │ │ ├── GelfHandler.php │ │ ├── GroupHandler.php │ │ ├── HandlerInterface.php │ │ ├── HandlerWrapper.php │ │ ├── HipChatHandler.php │ │ ├── IFTTTHandler.php │ │ ├── InsightOpsHandler.php │ │ ├── LogEntriesHandler.php │ │ ├── LogglyHandler.php │ │ ├── MailHandler.php │ │ ├── MandrillHandler.php │ │ ├── MissingExtensionException.php │ │ ├── MongoDBHandler.php │ │ ├── NativeMailerHandler.php │ │ ├── NewRelicHandler.php │ │ ├── NullHandler.php │ │ ├── PHPConsoleHandler.php │ │ ├── ProcessableHandlerInterface.php │ │ ├── ProcessableHandlerTrait.php │ │ ├── PsrHandler.php │ │ ├── PushoverHandler.php │ │ ├── RavenHandler.php │ │ ├── RedisHandler.php │ │ ├── RollbarHandler.php │ │ ├── RotatingFileHandler.php │ │ ├── SamplingHandler.php │ │ ├── Slack │ │ │ └── SlackRecord.php │ │ ├── SlackHandler.php │ │ ├── SlackWebhookHandler.php │ │ ├── SlackbotHandler.php │ │ ├── SocketHandler.php │ │ ├── StreamHandler.php │ │ ├── SwiftMailerHandler.php │ │ ├── SyslogHandler.php │ │ ├── SyslogUdp │ │ │ └── UdpSocket.php │ │ ├── SyslogUdpHandler.php │ │ ├── TestHandler.php │ │ ├── WhatFailureGroupHandler.php │ │ └── ZendMonitorHandler.php │ │ ├── Logger.php │ │ ├── Processor │ │ ├── GitProcessor.php │ │ ├── IntrospectionProcessor.php │ │ ├── MemoryPeakUsageProcessor.php │ │ ├── MemoryProcessor.php │ │ ├── MemoryUsageProcessor.php │ │ ├── MercurialProcessor.php │ │ ├── ProcessIdProcessor.php │ │ ├── ProcessorInterface.php │ │ ├── PsrLogMessageProcessor.php │ │ ├── TagProcessor.php │ │ ├── UidProcessor.php │ │ └── WebProcessor.php │ │ ├── Registry.php │ │ ├── ResettableInterface.php │ │ ├── SignalHandler.php │ │ └── Utils.php │ └── psr │ └── log │ ├── .gitignore │ ├── LICENSE │ ├── Psr │ └── Log │ │ ├── AbstractLogger.php │ │ ├── InvalidArgumentException.php │ │ ├── LogLevel.php │ │ ├── LoggerAwareInterface.php │ │ ├── LoggerAwareTrait.php │ │ ├── LoggerInterface.php │ │ ├── LoggerTrait.php │ │ ├── NullLogger.php │ │ └── Test │ │ ├── LoggerInterfaceTest.php │ │ └── TestLogger.php │ ├── README.md │ └── composer.json ├── package.toml ├── rfcs └── 0001-restructure.md └── scripts ├── .util ├── builders.sh ├── print.sh ├── tools.json └── tools.sh ├── integration.sh └── package.sh /.github/.patch_files: -------------------------------------------------------------------------------- 1 | .github/.patch_files 2 | .github/.syncignore 3 | .github/CODEOWNERS 4 | .github/dependabot.yml 5 | .github/labels.yml 6 | .github/workflows/approve-bot-pr.yml 7 | .github/workflows/label-pr.yml 8 | .github/workflows/lint-yaml.yml 9 | .github/workflows/lint.yml 10 | .github/workflows/synchronize-labels.yml 11 | .github/workflows/test-pull-request.yml 12 | .github/workflows/update-buildpack-toml.yml 13 | .github/workflows/update-github-config.yml 14 | .gitignore 15 | LICENSE 16 | NOTICE 17 | README.md 18 | scripts/.util/builders.sh 19 | scripts/.util/print.sh 20 | scripts/.util/tools.json 21 | scripts/.util/tools.sh 22 | scripts/integration.sh 23 | -------------------------------------------------------------------------------- /.github/.syncignore: -------------------------------------------------------------------------------- 1 | CODEOWNERS 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @paketo-buildpacks/php-maintainers 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: gomod 5 | directory: "/" 6 | schedule: 7 | interval: daily 8 | allow: 9 | # Allow both direct and indirect updates for all packages 10 | - dependency-type: "all" 11 | # group all minor and patch dependency updates together 12 | groups: 13 | go-modules: 14 | patterns: 15 | - "*" 16 | update-types: 17 | - "minor" 18 | - "patch" 19 | exclude-patterns: 20 | - "github.com/anchore/stereoscope" 21 | - "github.com/testcontainers/testcontainers-go" 22 | - "github.com/docker/docker" 23 | - "github.com/containerd/containerd" 24 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | - name: status/possible-priority 2 | description: This issue is ready to work and should be considered as a potential priority 3 | color: F9D0C4 4 | - name: status/prioritized 5 | description: This issue has been triaged and resolving it is a priority 6 | color: BFD4F2 7 | - name: status/blocked 8 | description: This issue has been triaged and resolving it is blocked on some other issue 9 | color: 848978 10 | - name: bug 11 | description: Something isn't working 12 | color: d73a4a 13 | - name: enhancement 14 | description: A new feature or request 15 | color: a2eeef 16 | - name: documentation 17 | description: This issue relates to writing documentation 18 | color: D4C5F9 19 | - name: help wanted 20 | description: Extra attention is needed 21 | color: 008672 22 | - name: semver:major 23 | description: A change requiring a major version bump 24 | color: 6b230e 25 | - name: semver:minor 26 | description: A change requiring a minor version bump 27 | color: cc6749 28 | - name: semver:patch 29 | description: A change requiring a patch version bump 30 | color: f9d0c4 31 | - name: good first issue 32 | description: A good first issue to get started with 33 | color: d3fc03 34 | - name: "failure:release" 35 | description: An issue filed automatically when a release workflow run fails 36 | color: f00a0a 37 | - name: "failure:push" 38 | description: An issue filed automatically when a push buildpackage workflow run fails 39 | color: f00a0a 40 | - name: "failure:update-buildpack-toml" 41 | description: An issue filed automatically when a buildpack.toml update workflow run fails 42 | color: f00a0a 43 | - name: "failure:update-github-config" 44 | description: An issue filed automatically when a github config update workflow run fails 45 | color: f00a0a 46 | - name: "failure:approve-bot-pr" 47 | description: An issue filed automatically when a PR auto-approve workflow run fails 48 | color: f00a0a 49 | -------------------------------------------------------------------------------- /.github/workflows/approve-bot-pr.yml: -------------------------------------------------------------------------------- 1 | name: Approve Bot PRs and Enable Auto-Merge 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["Test Pull Request"] 6 | types: 7 | - completed 8 | 9 | jobs: 10 | download: 11 | name: Download PR Artifact 12 | if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} 13 | runs-on: ubuntu-22.04 14 | outputs: 15 | pr-author: ${{ steps.pr-data.outputs.author }} 16 | pr-number: ${{ steps.pr-data.outputs.number }} 17 | steps: 18 | - name: 'Download artifact' 19 | uses: paketo-buildpacks/github-config/actions/pull-request/download-artifact@main 20 | with: 21 | name: "event-payload" 22 | repo: ${{ github.repository }} 23 | run_id: ${{ github.event.workflow_run.id }} 24 | workspace: "/github/workspace" 25 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 26 | - id: pr-data 27 | run: | 28 | echo "author=$(cat event.json | jq -r '.pull_request.user.login')" >> "$GITHUB_OUTPUT" 29 | echo "number=$(cat event.json | jq -r '.pull_request.number')" >> "$GITHUB_OUTPUT" 30 | 31 | approve: 32 | name: Approve Bot PRs 33 | needs: download 34 | if: ${{ needs.download.outputs.pr-author == 'paketo-bot' || needs.download.outputs.pr-author == 'dependabot[bot]' }} 35 | runs-on: ubuntu-22.04 36 | steps: 37 | - name: Check Commit Verification 38 | id: unverified-commits 39 | uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main 40 | with: 41 | token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} 42 | repo: ${{ github.repository }} 43 | number: ${{ needs.download.outputs.pr-number }} 44 | 45 | - name: Check for Human Commits 46 | id: human-commits 47 | uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main 48 | with: 49 | token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} 50 | repo: ${{ github.repository }} 51 | number: ${{ needs.download.outputs.pr-number }} 52 | 53 | - name: Checkout 54 | if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' 55 | uses: actions/checkout@v3 56 | 57 | - name: Approve 58 | if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' 59 | uses: paketo-buildpacks/github-config/actions/pull-request/approve@main 60 | with: 61 | token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} 62 | number: ${{ needs.download.outputs.pr-number }} 63 | 64 | - name: Enable Auto-Merge 65 | if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' 66 | run: | 67 | gh pr merge ${{ needs.download.outputs.pr-number }} --auto --rebase 68 | env: 69 | GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 70 | -------------------------------------------------------------------------------- /.github/workflows/label-pr.yml: -------------------------------------------------------------------------------- 1 | name: Set / Validate PR Labels 2 | on: 3 | pull_request_target: 4 | branches: 5 | - main 6 | types: 7 | - synchronize 8 | - opened 9 | - reopened 10 | - labeled 11 | - unlabeled 12 | 13 | concurrency: pr_labels_${{ github.event.number }} 14 | 15 | jobs: 16 | autolabel: 17 | name: Ensure Minimal Semver Labels 18 | runs-on: ubuntu-22.04 19 | steps: 20 | - name: Check Minimal Semver Labels 21 | uses: mheap/github-action-required-labels@v3 22 | with: 23 | count: 1 24 | labels: semver:major, semver:minor, semver:patch 25 | mode: exactly 26 | env: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | 29 | - name: Auto-label Semver 30 | if: ${{ failure() }} 31 | uses: paketo-buildpacks/github-config/actions/pull-request/auto-semver-label@main 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/lint-yaml.yml: -------------------------------------------------------------------------------- 1 | name: Lint Workflows 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - '.github/**.yml' 7 | - '.github/**.yaml' 8 | 9 | jobs: 10 | lintYaml: 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Checkout github-config 16 | uses: actions/checkout@v3 17 | with: 18 | repository: paketo-buildpacks/github-config 19 | path: github-config 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: 3.8 25 | 26 | - name: Install yamllint 27 | run: pip install yamllint 28 | 29 | - name: Lint YAML files 30 | run: yamllint ./.github -c github-config/.github/.yamllint 31 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | golangci: 13 | name: lint 14 | runs-on: ubuntu-22.04 15 | steps: 16 | - name: Setup Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 'stable' 20 | 21 | - name: Checkout 22 | uses: actions/checkout@v3 23 | 24 | - name: golangci-lint 25 | uses: golangci/golangci-lint-action@v3 26 | with: 27 | version: latest 28 | args: --timeout 3m0s 29 | -------------------------------------------------------------------------------- /.github/workflows/publish-releases.yml: -------------------------------------------------------------------------------- 1 | name: Publish Draft Releases 2 | 3 | on: 4 | workflow_dispatch: {} 5 | schedule: 6 | - cron: '0 5 * * FRI' # Weekly on Friday at 5:00 AM UTC 7 | 8 | concurrency: 9 | group: publish-release 10 | 11 | jobs: 12 | publish: 13 | name: Publish 14 | runs-on: ubuntu-22.04 15 | steps: 16 | - name: Publish Draft Release With Highest Semantic Version 17 | id: drafts 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 20 | uses: paketo-buildpacks/github-config/actions/release/publish-drafts@main 21 | with: 22 | repo: ${{ github.repository }} 23 | 24 | failure: 25 | name: Alert on Failure 26 | runs-on: ubuntu-22.04 27 | needs: [ publish ] 28 | if: ${{ always() && needs.publish.result == 'failure' }} 29 | steps: 30 | - name: File Failure Alert Issue 31 | uses: paketo-buildpacks/github-config/actions/issue/file@main 32 | with: 33 | token: ${{ secrets.GITHUB_TOKEN }} 34 | repo: ${{ github.repository }} 35 | label: "failure:release" 36 | comment_if_exists: true 37 | issue_title: "Failure: Publish draft releases" 38 | issue_body: | 39 | Publish All Draft Releases workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). 40 | comment_body: | 41 | Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 42 | -------------------------------------------------------------------------------- /.github/workflows/synchronize-labels.yml: -------------------------------------------------------------------------------- 1 | name: Synchronize Labels 2 | "on": 3 | push: 4 | branches: 5 | - main 6 | paths: 7 | - .github/labels.yml 8 | workflow_dispatch: {} 9 | jobs: 10 | synchronize: 11 | name: Synchronize Labels 12 | runs-on: 13 | - ubuntu-22.04 14 | steps: 15 | - uses: actions/checkout@v3 16 | - uses: micnncim/action-label-syncer@v1 17 | env: 18 | GITHUB_TOKEN: ${{ github.token }} 19 | -------------------------------------------------------------------------------- /.github/workflows/test-pull-request.yml: -------------------------------------------------------------------------------- 1 | name: Test Pull Request 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | 8 | concurrency: 9 | # only one instance of test suite per PR at one time 10 | group: pr-${{ github.event.number }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | builders: 15 | name: Get Builders for Testing 16 | runs-on: ubuntu-22.04 17 | outputs: 18 | builders: ${{ steps.builders.outputs.builders }} 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v3 22 | - name: Get builders from integration.json 23 | id: builders 24 | run: | 25 | source "${{ github.workspace }}/scripts/.util/builders.sh" 26 | 27 | builders="$(util::builders::list "${{ github.workspace }}/integration.json")" 28 | printf "Output: %s\n" "${builders}" 29 | printf "builders=%s\n" "${builders}" >> "$GITHUB_OUTPUT" 30 | 31 | integration: 32 | name: Integration Tests with Builders 33 | runs-on: ubuntu-22.04 34 | needs: [builders] 35 | strategy: 36 | matrix: 37 | builder: ${{ fromJSON(needs.builders.outputs.builders) }} 38 | fail-fast: false # don't cancel all test jobs when one fails 39 | steps: 40 | - name: Setup Go 41 | uses: actions/setup-go@v3 42 | with: 43 | go-version: 'stable' 44 | 45 | - name: Checkout 46 | uses: actions/checkout@v3 47 | 48 | - name: Run Integration Tests 49 | env: 50 | TMPDIR: "${{ runner.temp }}" 51 | run: ./scripts/integration.sh --builder ${{ matrix.builder }} 52 | 53 | roundup: 54 | name: Integration Tests 55 | if: ${{ always() }} 56 | runs-on: ubuntu-22.04 57 | needs: integration 58 | steps: 59 | - run: | 60 | result="${{ needs.integration.result }}" 61 | if [[ $result == "success" ]]; then 62 | echo "Integration tests passed against all builders" 63 | exit 0 64 | else 65 | echo "Integration tests failed on one or more builders" 66 | exit 1 67 | fi 68 | 69 | upload: 70 | name: Upload Workflow Event Payload 71 | runs-on: ubuntu-22.04 72 | steps: 73 | - name: Upload Artifact 74 | uses: actions/upload-artifact@v3 75 | with: 76 | name: event-payload 77 | path: ${{ github.event_path }} 78 | -------------------------------------------------------------------------------- /.github/workflows/update-buildpack-toml.yml: -------------------------------------------------------------------------------- 1 | name: Update buildpack.toml 2 | 3 | on: 4 | schedule: 5 | - cron: '1 6 * * *' # daily at 06:01 UTC 6 | workflow_dispatch: {} 7 | 8 | concurrency: buildpack_update 9 | 10 | jobs: 11 | update-buildpack-toml: 12 | runs-on: ubuntu-22.04 13 | name: Update buildpack.toml 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v3 18 | 19 | - name: Checkout Branch 20 | uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main 21 | with: 22 | branch: automation/buildpack.toml/update 23 | 24 | - name: Update buildpack.toml 25 | id: update 26 | uses: paketo-buildpacks/github-config/actions/buildpack/update@main 27 | 28 | - name: Commit 29 | id: commit 30 | uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main 31 | with: 32 | message: "Updating buildpacks in buildpack.toml" 33 | pathspec: "." 34 | keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} 35 | key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} 36 | 37 | - name: Push Branch 38 | if: ${{ steps.commit.outputs.commit_sha != '' }} 39 | uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main 40 | with: 41 | branch: automation/buildpack.toml/update 42 | 43 | - name: Open Pull Request (no semver label) 44 | if: ${{ steps.commit.outputs.commit_sha != '' && steps.update.outputs.semver_bump == '' }} 45 | uses: paketo-buildpacks/github-config/actions/pull-request/open@main 46 | with: 47 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 48 | title: "Updates buildpacks in buildpack.toml" 49 | branch: automation/buildpack.toml/update 50 | 51 | - name: Open Pull Request 52 | if: ${{ steps.commit.outputs.commit_sha != '' && steps.update.outputs.semver_bump != '' }} 53 | uses: paketo-buildpacks/github-config/actions/pull-request/open@main 54 | with: 55 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 56 | title: "Updates buildpacks in buildpack.toml" 57 | branch: automation/buildpack.toml/update 58 | label: "semver:${{ steps.update.outputs.semver_bump }}" 59 | 60 | failure: 61 | name: Alert on Failure 62 | runs-on: ubuntu-22.04 63 | needs: [update-buildpack-toml] 64 | if: ${{ always() && needs.update-buildpack-toml.result == 'failure' }} 65 | steps: 66 | - name: File Failure Alert Issue 67 | uses: paketo-buildpacks/github-config/actions/issue/file@main 68 | with: 69 | token: ${{ secrets.GITHUB_TOKEN }} 70 | repo: ${{ github.repository }} 71 | label: "failure:update-buildpack-toml" 72 | comment_if_exists: true 73 | issue_title: "Failure: Update Buildpack TOML workflow" 74 | issue_body: | 75 | Update Buildpack TOML workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). 76 | comment_body: | 77 | Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 78 | -------------------------------------------------------------------------------- /.github/workflows/update-github-config.yml: -------------------------------------------------------------------------------- 1 | name: Update shared github-config 2 | 3 | on: 4 | schedule: 5 | - cron: '20 17 * * *' # daily at 17:20 UTC 6 | workflow_dispatch: {} 7 | 8 | concurrency: github_config_update 9 | 10 | jobs: 11 | build: 12 | name: Create PR to update shared files 13 | runs-on: ubuntu-22.04 14 | steps: 15 | 16 | - name: Checkout 17 | uses: actions/checkout@v3 18 | with: 19 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 20 | 21 | - name: Checkout github-config 22 | uses: actions/checkout@v3 23 | with: 24 | repository: paketo-buildpacks/github-config 25 | path: github-config 26 | 27 | - name: Checkout Branch 28 | uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main 29 | with: 30 | branch: automation/github-config/update 31 | 32 | - name: Run the sync action 33 | uses: paketo-buildpacks/github-config/actions/sync@main 34 | with: 35 | workspace: /github/workspace 36 | config: /github/workspace/github-config/language-family 37 | 38 | - name: Cleanup 39 | run: rm -rf github-config 40 | 41 | - name: Commit 42 | id: commit 43 | uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main 44 | with: 45 | message: "Updating github-config" 46 | pathspec: "." 47 | keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} 48 | key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} 49 | 50 | - name: Push Branch 51 | if: ${{ steps.commit.outputs.commit_sha != '' }} 52 | uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main 53 | with: 54 | branch: automation/github-config/update 55 | 56 | - name: Open Pull Request 57 | if: ${{ steps.commit.outputs.commit_sha != '' }} 58 | uses: paketo-buildpacks/github-config/actions/pull-request/open@main 59 | with: 60 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 61 | title: "Updates github-config" 62 | branch: automation/github-config/update 63 | 64 | failure: 65 | name: Alert on Failure 66 | runs-on: ubuntu-22.04 67 | needs: [build] 68 | if: ${{ always() && needs.build.result == 'failure' }} 69 | steps: 70 | - name: File Failure Alert Issue 71 | uses: paketo-buildpacks/github-config/actions/issue/file@main 72 | with: 73 | token: ${{ secrets.GITHUB_TOKEN }} 74 | repo: ${{ github.repository }} 75 | label: "failure:update-github-config" 76 | comment_if_exists: true 77 | issue_title: "Failure: Update GitHub config workflow" 78 | issue_body: | 79 | Update GitHub config workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). 80 | comment_body: | 81 | Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 82 | -------------------------------------------------------------------------------- /.github/workflows/update-go-mod-version.yml: -------------------------------------------------------------------------------- 1 | name: Update Go version 2 | 3 | on: 4 | schedule: 5 | - cron: '13 4 * * MON' # every monday at 4:13 UTC 6 | workflow_dispatch: 7 | 8 | concurrency: update-go 9 | 10 | jobs: 11 | update-go: 12 | name: Update go toolchain in go.mod 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Check out code 16 | uses: actions/checkout@v4 17 | - name: Checkout PR Branch 18 | uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main 19 | with: 20 | branch: automation/go-mod-update/update-main 21 | - name: Setup Go 22 | id: setup-go 23 | uses: actions/setup-go@v5 24 | with: 25 | go-version: 'stable' 26 | - name: Get current go toolchain version 27 | id: current-go-version 28 | uses: paketo-buildpacks/github-config/actions/update-go-mod-version@main 29 | with: 30 | go-version: ${{ steps.setup-go.outputs.go-version }} 31 | - name: Go mod tidy 32 | run: | 33 | #!/usr/bin/env bash 34 | set -euo pipefail 35 | shopt -s inherit_errexit 36 | 37 | echo "Before running go mod tidy" 38 | echo "head -n10 go.mod " 39 | head -n10 go.mod 40 | 41 | echo "git diff" 42 | git diff 43 | 44 | echo "Running go mod tidy" 45 | go mod tidy 46 | 47 | echo "After running go mod tidy" 48 | echo "head -n10 go.mod " 49 | head -n10 go.mod 50 | 51 | echo "git diff" 52 | git diff 53 | - name: Commit 54 | id: commit 55 | uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main 56 | with: 57 | message: "Updates go mod version to ${{ steps.setup-go.outputs.go-version }}" 58 | pathspec: "." 59 | keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} 60 | key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} 61 | 62 | - name: Push Branch 63 | if: ${{ steps.commit.outputs.commit_sha != '' }} 64 | uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main 65 | with: 66 | branch: automation/go-mod-update/update-main 67 | 68 | - name: Open Pull Request 69 | if: ${{ steps.commit.outputs.commit_sha != '' }} 70 | uses: paketo-buildpacks/github-config/actions/pull-request/open@main 71 | with: 72 | token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} 73 | title: "Updates go mod version to ${{ steps.setup-go.outputs.go-version }}" 74 | branch: automation/go-mod-update/update-main 75 | 76 | failure: 77 | name: Alert on Failure 78 | runs-on: ubuntu-22.04 79 | needs: [update-go] 80 | if: ${{ always() && needs.update-go.result == 'failure' }} 81 | steps: 82 | - name: File Failure Alert Issue 83 | uses: paketo-buildpacks/github-config/actions/issue/file@main 84 | with: 85 | token: ${{ secrets.GITHUB_TOKEN }} 86 | repo: ${{ github.repository }} 87 | label: "failure:update-go-version" 88 | comment_if_exists: true 89 | issue_title: "Failure: Update Go Mod Version workflow" 90 | issue_body: | 91 | Update Go Mod Version workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). 92 | comment_body: | 93 | Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 94 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bin 2 | /build 3 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | php-cnb 2 | 3 | Copyright (c) 2013-Present CloudFoundry.org Foundation, Inc. All Rights Reserved. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Paketo Buildpack for PHP 2 | ## `gcr.io/paketo-buildpacks/php` 3 | 4 | The PHP Paketo Buildpack provides a set of collaborating buildpacks that 5 | enable the building of a PHP-based application. These buildpacks include: 6 | - [PHP Dist CNB](https://github.com/paketo-buildpacks/php-dist) 7 | - [PHP HTTPD CNB](https://github.com/paketo-buildpacks/php-httpd) 8 | - [PHP Nginx CNB](https://github.com/paketo-buildpacks/php-nginx) 9 | - [PHP Built-in Server CNB](https://github.com/paketo-buildpacks/php-builtin-server) 10 | - [PHP FPM CNB](https://github.com/paketo-buildpacks/php-fpm) 11 | - [PHP Start CNB](https://github.com/paketo-buildpacks/php-start) 12 | - [PHP Redis Session Handler CNB](https://github.com/paketo-buildpacks/php-redis-session-handler) 13 | - [PHP Memcached Session Handler CNB](https://github.com/paketo-buildpacks/php-memcached-session-handler) 14 | - [Composer CNB](https://github.com/paketo-buildpacks/composer) 15 | - [Composer Install CNB](https://github.com/paketo-buildpacks/composer-install) 16 | - [Apache HTTPD CNB](https://github.com/paketo-buildpacks/httpd) 17 | - [NGINX CNB](https://github.com/paketo-buildpacks/nginx) 18 | 19 | The buildpack supports building PHP console and web applications. Web 20 | applications can be run on either the [built-in PHP 21 | webserver](https://www.php.net/manual/en/features.commandline.webserver.php), 22 | [Apache HTTPD](https://httpd.apache.org/) or [NGINX](https://www.nginx.com/). 23 | The buildpack also provides optional support for the utilization of 24 | [Composer](https://getcomposer.org) as a package manager. 25 | 26 | Usage examples can be found in the 27 | [`samples` repository under the `php` directory](https://github.com/paketo-buildpacks/samples/tree/main/php). 28 | 29 | This buildpack also includes the following utility buildpacks: 30 | - [Procfile CNB](https://github.com/paketo-buildpacks/procfile) 31 | - [Environment Variables CNB](https://github.com/paketo-buildpacks/environment-variables) 32 | - [Image Labels CNB](https://github.com/paketo-buildpacks/image-labels) 33 | - [CA Certificates CNB](https://github.com/paketo-buildpacks/ca-certificates) 34 | 35 | #### The PHP buildpack is compatible with the following builder(s): 36 | 37 | - [Paketo Jammy Full Builder](https://github.com/paketo-buildpacks/builder-jammy-full) 38 | - [Paketo Bionic Full Builder](https://github.com/paketo-buildpacks/full-builder) 39 | 40 | #### Docs 41 | 42 | Check out the [PHP Paketo Buildpack 43 | docs](https://paketo.io/docs/buildpacks/language-family-buildpacks/php) for 44 | more information. 45 | -------------------------------------------------------------------------------- /integration.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | "index.docker.io/paketobuildpacks/builder-jammy-buildpackless-full:latest", 4 | "index.docker.io/paketobuildpacks/builder:buildpackless-full" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /integration/composer_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "testing" 8 | 9 | "github.com/paketo-buildpacks/occam" 10 | "github.com/sclevine/spec" 11 | 12 | . "github.com/onsi/gomega" 13 | . "github.com/paketo-buildpacks/occam/matchers" 14 | ) 15 | 16 | func testComposer(t *testing.T, context spec.G, it spec.S) { 17 | var ( 18 | Expect = NewWithT(t).Expect 19 | Eventually = NewWithT(t).Eventually 20 | 21 | pack occam.Pack 22 | docker occam.Docker 23 | ) 24 | 25 | it.Before(func() { 26 | pack = occam.NewPack().WithVerbose() 27 | docker = occam.NewDocker() 28 | }) 29 | 30 | context("building a PHP app that contains vendored Composer packages", func() { 31 | var ( 32 | image occam.Image 33 | container occam.Container 34 | 35 | name string 36 | source string 37 | ) 38 | 39 | it.Before(func() { 40 | var err error 41 | name, err = occam.RandomName() 42 | Expect(err).NotTo(HaveOccurred()) 43 | source, err = occam.Source(filepath.Join("testdata", "vendored_composer_app")) 44 | Expect(err).NotTo(HaveOccurred()) 45 | }) 46 | 47 | it.After(func() { 48 | Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed()) 49 | Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) 50 | Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) 51 | Expect(os.RemoveAll(source)).To(Succeed()) 52 | }) 53 | 54 | it("creates a working OCI image", func() { 55 | var err error 56 | var logs fmt.Stringer 57 | image, logs, err = pack.WithNoColor().Build. 58 | WithBuildpacks(phpBuildpack). 59 | WithEnv(map[string]string{ 60 | "BP_PHP_SERVER": "httpd", 61 | }). 62 | WithPullPolicy("never"). 63 | Execute(name, source) 64 | Expect(err).NotTo(HaveOccurred(), logs.String()) 65 | 66 | container, err = docker.Container.Run. 67 | WithEnv(map[string]string{"PORT": "8080"}). 68 | WithPublish("8080"). 69 | WithPublishAll(). 70 | Execute(image.ID) 71 | Expect(err).NotTo(HaveOccurred()) 72 | 73 | Eventually(container).Should(Serve(ContainSubstring("This is a PHP app.")).OnPort(8080)) 74 | 75 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for CA Certificates"))) 76 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP Distribution"))) 77 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Composer"))) 78 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Composer Install"))) 79 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Apache HTTP Server"))) 80 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP FPM"))) 81 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP HTTPD"))) 82 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP Start"))) 83 | }) 84 | }) 85 | } 86 | -------------------------------------------------------------------------------- /integration/init_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "fmt" 5 | "os/exec" 6 | "path/filepath" 7 | "testing" 8 | "time" 9 | 10 | "github.com/paketo-buildpacks/occam" 11 | "github.com/sclevine/spec" 12 | "github.com/sclevine/spec/report" 13 | 14 | . "github.com/onsi/gomega" 15 | "github.com/onsi/gomega/format" 16 | ) 17 | 18 | var ( 19 | phpBuildpack string 20 | builder occam.Builder 21 | memcachedImage string 22 | redisImage string 23 | ) 24 | 25 | func TestIntegration(t *testing.T) { 26 | pack := occam.NewPack() 27 | docker := occam.NewDocker() 28 | Expect := NewWithT(t).Expect 29 | 30 | format.MaxLength = 0 31 | 32 | output, err := exec.Command("bash", "-c", "../scripts/package.sh --version 1.2.3").CombinedOutput() 33 | Expect(err).NotTo(HaveOccurred(), string(output)) 34 | 35 | phpBuildpack, err = filepath.Abs("../build/buildpackage.cnb") 36 | Expect(err).NotTo(HaveOccurred()) 37 | 38 | SetDefaultEventuallyTimeout(10 * time.Second) 39 | 40 | builder, err = pack.Builder.Inspect.Execute() 41 | Expect(err).NotTo(HaveOccurred()) 42 | 43 | // pull and re-tag memcached image with builder-specific naming 44 | // this will prevent flakes in which we try to reference/remove the same image in parallel bionic/jammy builder tests 45 | memcachedImage = fmt.Sprintf("memcached-%s:latest", builder.LocalInfo.Stack.ID) 46 | Expect(docker.Pull.Execute("memcached:latest")).To(Succeed()) 47 | Expect(docker.Image.Tag.Execute("memcached:latest", memcachedImage)).To(Succeed()) 48 | Expect(docker.Image.Remove.WithForce().Execute("memcached:latest")).To(Succeed()) 49 | 50 | // pull and re-tag redis image with builder-specific naming 51 | // this will prevent flakes in which we try to reference/remove the same image in parallel bionic/jammy builder tests 52 | redisImage = fmt.Sprintf("redis-%s:latest", builder.LocalInfo.Stack.ID) 53 | Expect(docker.Pull.Execute("redis:latest")).To(Succeed()) 54 | Expect(docker.Image.Tag.Execute("redis:latest", redisImage)).To(Succeed()) 55 | Expect(docker.Image.Remove.WithForce().Execute("redis:latest")).To(Succeed()) 56 | 57 | suite := spec.New("Integration", spec.Parallel(), spec.Report(report.Terminal{})) 58 | 59 | // This test will only run on the Bionic full stack, to test the stack upgrade scenario. 60 | // All other tests will run against the Bionic full stack and Jammy full stack 61 | if builder.BuilderName == "paketobuildpacks/builder:buildpackless-full" { 62 | suite("StackUpgrades", testStackUpgrades) 63 | } 64 | 65 | suite("Builtin Server", testPhpBuiltinServer) 66 | suite("Composer", testComposer) 67 | suite("HTTPD", testPhpHttpd) 68 | suite("Memcached Session Handler", testMemcachedSessionHandler) 69 | suite("Nginx", testPhpNginx) 70 | suite("Redis Session Handler", testRedisSessionHandler) 71 | suite("Reproducible Builds", testReproducibleBuilds) 72 | suite.Run(t) 73 | 74 | // Clean up memcached image 75 | Expect(docker.Image.Remove.WithForce().Execute(memcachedImage)).To(Succeed()) 76 | // Clean up redis image 77 | Expect(docker.Image.Remove.WithForce().Execute(redisImage)).To(Succeed()) 78 | } 79 | -------------------------------------------------------------------------------- /integration/redis_session_handler_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "net/http/cookiejar" 7 | "os" 8 | "path/filepath" 9 | "testing" 10 | 11 | "github.com/paketo-buildpacks/occam" 12 | "github.com/sclevine/spec" 13 | 14 | . "github.com/onsi/gomega" 15 | . "github.com/paketo-buildpacks/occam/matchers" 16 | ) 17 | 18 | func testRedisSessionHandler(t *testing.T, context spec.G, it spec.S) { 19 | var ( 20 | Expect = NewWithT(t).Expect 21 | Eventually = NewWithT(t).Eventually 22 | 23 | pack occam.Pack 24 | docker occam.Docker 25 | source string 26 | name string 27 | ) 28 | 29 | it.Before(func() { 30 | pack = occam.NewPack().WithVerbose() 31 | docker = occam.NewDocker() 32 | }) 33 | 34 | context("building a PHP app that uses a redis session handler", func() { 35 | var ( 36 | image occam.Image 37 | container occam.Container 38 | redisContainer occam.Container 39 | binding string 40 | ) 41 | 42 | it.Before(func() { 43 | var err error 44 | name, err = occam.RandomName() 45 | Expect(err).NotTo(HaveOccurred()) 46 | 47 | source, err = occam.Source(filepath.Join("testdata", "session_handler_apps")) 48 | Expect(err).NotTo(HaveOccurred()) 49 | 50 | binding = filepath.Join(source, "redis_binding") 51 | 52 | redisContainer, err = docker.Container.Run. 53 | WithPublish("6379"). 54 | Execute(redisImage) 55 | Expect(err).NotTo(HaveOccurred()) 56 | 57 | ipAddress, err := redisContainer.IPAddressForNetwork("bridge") 58 | Expect(err).NotTo(HaveOccurred()) 59 | 60 | Expect(os.WriteFile(filepath.Join(source, "redis_binding", "host"), []byte(ipAddress), os.ModePerm)).To(Succeed()) 61 | }) 62 | 63 | it.After(func() { 64 | Expect(docker.Container.Remove.Execute(redisContainer.ID)).To(Succeed()) 65 | Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed()) 66 | Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) 67 | Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) 68 | Expect(os.RemoveAll(source)).To(Succeed()) 69 | }) 70 | 71 | it("creates a working OCI image", func() { 72 | var err error 73 | var logs fmt.Stringer 74 | image, logs, err = pack.WithNoColor().Build. 75 | WithBuildpacks(phpBuildpack). 76 | WithEnv(map[string]string{ 77 | "BP_PHP_WEB_DIR": "htdocs", 78 | "BP_LOG_LEVEL": "DEBUG", 79 | "SERVICE_BINDING_ROOT": "/bindings", 80 | }). 81 | WithPullPolicy("never"). 82 | WithVolumes(fmt.Sprintf("%s:/bindings/php-redis-session", binding)). 83 | Execute(name, source) 84 | Expect(err).NotTo(HaveOccurred(), logs.String()) 85 | 86 | container, err = docker.Container.Run. 87 | WithEnv(map[string]string{"PORT": "8080"}). 88 | WithPublish("8080"). 89 | WithPublishAll(). 90 | Execute(image.ID) 91 | Expect(err).NotTo(HaveOccurred()) 92 | 93 | jar, err := cookiejar.New(nil) 94 | Expect(err).NotTo(HaveOccurred()) 95 | 96 | client := &http.Client{ 97 | Jar: jar, 98 | } 99 | 100 | Eventually(container).Should(Serve(ContainSubstring("1")).WithClient(client).OnPort(8080).WithEndpoint("/index.php")) 101 | Eventually(container).Should(Serve(ContainSubstring("2")).WithClient(client).OnPort(8080).WithEndpoint("/index.php")) 102 | 103 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP Distribution"))) 104 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP Built-in Server"))) 105 | Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for PHP Redis Session Handler"))) 106 | }) 107 | }) 108 | } 109 | -------------------------------------------------------------------------------- /integration/stack_upgrade_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "testing" 8 | 9 | "github.com/paketo-buildpacks/occam" 10 | "github.com/sclevine/spec" 11 | 12 | . "github.com/onsi/gomega" 13 | . "github.com/paketo-buildpacks/occam/matchers" 14 | ) 15 | 16 | func testStackUpgrades(t *testing.T, context spec.G, it spec.S) { 17 | var ( 18 | Expect = NewWithT(t).Expect 19 | Eventually = NewWithT(t).Eventually 20 | 21 | imageIDs map[string]struct{} 22 | containerIDs map[string]struct{} 23 | 24 | pack occam.Pack 25 | docker occam.Docker 26 | 27 | name string 28 | source string 29 | ) 30 | 31 | it.Before(func() { 32 | var err error 33 | name, err = occam.RandomName() 34 | Expect(err).NotTo(HaveOccurred()) 35 | 36 | pack = occam.NewPack() 37 | docker = occam.NewDocker() 38 | 39 | imageIDs = map[string]struct{}{} 40 | containerIDs = map[string]struct{}{} 41 | 42 | // pull images associated with the jammy builder incase they haven't been pulled yet 43 | Expect(docker.Pull.Execute("paketobuildpacks/builder-jammy-buildpackless-full")).To(Succeed()) 44 | Expect(docker.Pull.Execute("paketobuildpacks/run-jammy-full")).To(Succeed()) 45 | jammyBuilder, err := pack.Builder.Inspect.Execute("paketobuildpacks/builder-jammy-buildpackless-full") 46 | Expect(err).NotTo(HaveOccurred()) 47 | Expect(docker.Pull.Execute( 48 | fmt.Sprintf("%s:%s", "buildpacksio/lifecycle", jammyBuilder.RemoteInfo.Lifecycle.Version), 49 | )).To(Succeed()) 50 | }) 51 | 52 | it.After(func() { 53 | for id := range containerIDs { 54 | Expect(docker.Container.Remove.Execute(id)).To(Succeed()) 55 | } 56 | 57 | for id := range imageIDs { 58 | Expect(docker.Image.Remove.Execute(id)).To(Succeed()) 59 | } 60 | 61 | Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) 62 | Expect(os.RemoveAll(source)).To(Succeed()) 63 | }) 64 | 65 | context("building a composer app and the stack changes between builds", func() { 66 | var ( 67 | err error 68 | logs fmt.Stringer 69 | firstImage occam.Image 70 | secondImage occam.Image 71 | 72 | firstContainer occam.Container 73 | secondContainer occam.Container 74 | ) 75 | 76 | it.Before(func() { 77 | source, err = occam.Source(filepath.Join("testdata", "vendored_composer_app")) 78 | Expect(err).NotTo(HaveOccurred()) 79 | }) 80 | 81 | it("creates a working OCI image on rebuild", func() { 82 | build := pack.WithNoColor().Build. 83 | WithPullPolicy("never"). 84 | WithEnv(map[string]string{ 85 | "BP_PHP_SERVER": "httpd", 86 | }). 87 | WithBuildpacks(phpBuildpack) 88 | 89 | firstImage, logs, err = build.Execute(name, source) 90 | Expect(err).NotTo(HaveOccurred(), logs.String()) 91 | imageIDs[firstImage.ID] = struct{}{} 92 | 93 | firstContainer, err = docker.Container.Run. 94 | WithEnv(map[string]string{"PORT": "8080"}). 95 | WithPublish("8080"). 96 | WithPublishAll(). 97 | Execute(firstImage.ID) 98 | Expect(err).NotTo(HaveOccurred()) 99 | 100 | containerIDs[firstContainer.ID] = struct{}{} 101 | Eventually(firstContainer).Should(Serve(ContainSubstring("This is a PHP app.")).OnPort(8080)) 102 | 103 | secondImage, logs, err = build.WithBuilder("paketobuildpacks/builder-jammy-buildpackless-full").Execute(name, source) 104 | Expect(err).NotTo(HaveOccurred(), logs.String()) 105 | 106 | imageIDs[secondImage.ID] = struct{}{} 107 | 108 | secondContainer, err = docker.Container.Run. 109 | WithEnv(map[string]string{"PORT": "8080"}). 110 | WithPublish("8080"). 111 | WithPublishAll(). 112 | Execute(secondImage.ID) 113 | Expect(err).NotTo(HaveOccurred()) 114 | 115 | containerIDs[secondContainer.ID] = struct{}{} 116 | Eventually(secondContainer).Should(Serve(ContainSubstring("This is a PHP app.")).OnPort(8080)) 117 | }) 118 | }) 119 | } 120 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/binding/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFeTCCA2GgAwIBAgICB+UwDQYJKoZIhvcNAQELBQAwTjEaMBgGA1UEChMRUGFr 3 | ZXRvIEJ1aWxkcGFja3MxMDAuBgNVBAMTJ1Bha2V0byBCdWlsZHBhY2tzIENlcnRp 4 | ZmljYXRlIEF1dGhvcml0eTAeFw0yMTAzMDIxNjU5MjRaFw0zMTAzMDIxNjU5MjRa 5 | ME4xGjAYBgNVBAoTEVBha2V0byBCdWlsZHBhY2tzMTAwLgYDVQQDEydQYWtldG8g 6 | QnVpbGRwYWNrcyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEB 7 | AQUAA4ICDwAwggIKAoICAQDGQS7V1sKolBHl7WV19S3sDZwUCP4BR0UrZqvR2hmm 8 | v0D1tsxmVDepX0hbQOMUq9oiSsDga2uNrVfvLNC81PZF+KePgTawdIVCF6eSPZyY 9 | muVDorvd7UGpKdx1AL3Ez+QhLj9PGP1EW6nU7oD/6XzJWeRkNZWxPNP0Ev6fChfN 10 | qKXkPJYNHPrq3G7LQ6do7oaexXEOMd+lxLtUObSXyzMQn50olkxbogLC0ncNb17h 11 | 8f0YzogQnZxe0LIkXTkbq47UJcZyZVXe4Vjuf6YXP8NY8ABW380hSbI/aHR0btD1 12 | mA24ups0XGcqD/4v8LtrEFm1pBC58faDQi435hVvaiuzz9wbhAMh1J18/FbiqnkR 13 | P+l2nEQOButa1F4ClZZ989bhJboW6LSafQRJT4yAzfRuTXBzAWFYJrikdVabfnwZ 14 | z2rZrR4lgj5IklEnTk1DiJVvNP87faTY4L0CZexrjj4YRq0BLvMG7hAkJ/7/5WZK 15 | nNSJf+P7PNyDNWUPR+aN8R411PUG53Mxyi+lumi6eucmLQONCIuI2EdQ4iPP+QR4 16 | 7r1eLS/+Sxn4mifux6GcDbzTrJDHXtaqCFWRyKUdooEo7dJVceJ/lxJLpn8W/enH 17 | OJs8J9IkUjtYizNkfDniIvHQoU3mQZx6P8AzKTJ7XA5i3Xw+YUVaM/z91aQML5sz 18 | xQIDAQABo2EwXzAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0lBBYwFAYIKwYBBQUHAwIG 19 | CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEwwGrd7Rto0v2qq 20 | YBRt7pucOSjzMA0GCSqGSIb3DQEBCwUAA4ICAQBHNA41hSIBvV7DNy7Winm1ls0R 21 | bICOEawuUOZnKY3Feq1XPsPj1IHaOa4TEwPyOFs89tS5Fig5jIDtpHp+f2dYRknC 22 | eLKjDBZRUWnsuHQIR0MS4k8Bp6ztMiUTdAUSiY+Xv11sa4qGo/NCQdVSzp4wBEBM 23 | ZgnPTF9jU2OjxTufTDhbvYNAbM1l8+aBdF4/88s6D5OEbp3mYhCy8t82x7FKmLee 24 | 9GcQHoZxZjdcJfX5pBtDo9nakeLVbg5PgRUbFsaZyVXQL56VhfEYiM3UzqZCDDuh 25 | L+WU0pFkg0TX1xZ6438N8WD0zg44ObKEORfEvPAxbcKa+Nb8p1WsMKJmbeDDaXib 26 | wu7A+kWa5s4rf9zlDt0Y4wVFNuO602dO6VFyZXg8dcRyjRNa/0w/l4elgOPRonbl 27 | 8P9JY1KtIkZvQ8+f7NwloSGg+/Q0j2XqTSM04TP+RQ92iSNfsm+x8gZotKdUrvUN 28 | /7sLRgJvlJoBQ+bSHveT7r1IXE0zkM8535kYD8UEQ68cqZUEDOwK8qo2n4HY5oQ3 29 | 4BTkHOAEu39Ov6MrgeiSDzINc2eBadJcb5CwTKH17gLGDeQz8H4fRKSv2+6Pty6H 30 | esKmgqCE28Xnaz3snOEYSRfnG0+o5rgrXFUd0qAjpiu/rqCOXl9TeSEUM+YvjjRC 31 | /HNPsIbBVFyt0n7mYw== 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/binding/type: -------------------------------------------------------------------------------- 1 | ca-certificates 2 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/httpd_app/.httpd.conf.d/custom.conf: -------------------------------------------------------------------------------- 1 | LoadModule ssl_module modules/mod_ssl.so 2 | 3 | SSLEngine on 4 | 5 | # Server key pair 6 | SSLCertificateFile "/workspace/certs/cert.pem" 7 | SSLCertificateKeyFile "/workspace/certs/key.pem" 8 | 9 | SSLVerifyClient require 10 | SSLVerifyDepth 1 11 | 12 | # ca-certificate buildpack guarantees that the added CAs 13 | # are available via $SSL_CERT_DIR 14 | SSLCACertificatePath "${SSL_CERT_DIR}" 15 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/httpd_app/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFeTCCA2GgAwIBAgICB+UwDQYJKoZIhvcNAQELBQAwTjEaMBgGA1UEChMRUGFr 3 | ZXRvIEJ1aWxkcGFja3MxMDAuBgNVBAMTJ1Bha2V0byBCdWlsZHBhY2tzIENlcnRp 4 | ZmljYXRlIEF1dGhvcml0eTAeFw0yMTAzMDIxNjU5MjRaFw0zMTAzMDIxNjU5MjRa 5 | ME4xGjAYBgNVBAoTEVBha2V0byBCdWlsZHBhY2tzMTAwLgYDVQQDEydQYWtldG8g 6 | QnVpbGRwYWNrcyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEB 7 | AQUAA4ICDwAwggIKAoICAQDGQS7V1sKolBHl7WV19S3sDZwUCP4BR0UrZqvR2hmm 8 | v0D1tsxmVDepX0hbQOMUq9oiSsDga2uNrVfvLNC81PZF+KePgTawdIVCF6eSPZyY 9 | muVDorvd7UGpKdx1AL3Ez+QhLj9PGP1EW6nU7oD/6XzJWeRkNZWxPNP0Ev6fChfN 10 | qKXkPJYNHPrq3G7LQ6do7oaexXEOMd+lxLtUObSXyzMQn50olkxbogLC0ncNb17h 11 | 8f0YzogQnZxe0LIkXTkbq47UJcZyZVXe4Vjuf6YXP8NY8ABW380hSbI/aHR0btD1 12 | mA24ups0XGcqD/4v8LtrEFm1pBC58faDQi435hVvaiuzz9wbhAMh1J18/FbiqnkR 13 | P+l2nEQOButa1F4ClZZ989bhJboW6LSafQRJT4yAzfRuTXBzAWFYJrikdVabfnwZ 14 | z2rZrR4lgj5IklEnTk1DiJVvNP87faTY4L0CZexrjj4YRq0BLvMG7hAkJ/7/5WZK 15 | nNSJf+P7PNyDNWUPR+aN8R411PUG53Mxyi+lumi6eucmLQONCIuI2EdQ4iPP+QR4 16 | 7r1eLS/+Sxn4mifux6GcDbzTrJDHXtaqCFWRyKUdooEo7dJVceJ/lxJLpn8W/enH 17 | OJs8J9IkUjtYizNkfDniIvHQoU3mQZx6P8AzKTJ7XA5i3Xw+YUVaM/z91aQML5sz 18 | xQIDAQABo2EwXzAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0lBBYwFAYIKwYBBQUHAwIG 19 | CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEwwGrd7Rto0v2qq 20 | YBRt7pucOSjzMA0GCSqGSIb3DQEBCwUAA4ICAQBHNA41hSIBvV7DNy7Winm1ls0R 21 | bICOEawuUOZnKY3Feq1XPsPj1IHaOa4TEwPyOFs89tS5Fig5jIDtpHp+f2dYRknC 22 | eLKjDBZRUWnsuHQIR0MS4k8Bp6ztMiUTdAUSiY+Xv11sa4qGo/NCQdVSzp4wBEBM 23 | ZgnPTF9jU2OjxTufTDhbvYNAbM1l8+aBdF4/88s6D5OEbp3mYhCy8t82x7FKmLee 24 | 9GcQHoZxZjdcJfX5pBtDo9nakeLVbg5PgRUbFsaZyVXQL56VhfEYiM3UzqZCDDuh 25 | L+WU0pFkg0TX1xZ6438N8WD0zg44ObKEORfEvPAxbcKa+Nb8p1WsMKJmbeDDaXib 26 | wu7A+kWa5s4rf9zlDt0Y4wVFNuO602dO6VFyZXg8dcRyjRNa/0w/l4elgOPRonbl 27 | 8P9JY1KtIkZvQ8+f7NwloSGg+/Q0j2XqTSM04TP+RQ92iSNfsm+x8gZotKdUrvUN 28 | /7sLRgJvlJoBQ+bSHveT7r1IXE0zkM8535kYD8UEQ68cqZUEDOwK8qo2n4HY5oQ3 29 | 4BTkHOAEu39Ov6MrgeiSDzINc2eBadJcb5CwTKH17gLGDeQz8H4fRKSv2+6Pty6H 30 | esKmgqCE28Xnaz3snOEYSRfnG0+o5rgrXFUd0qAjpiu/rqCOXl9TeSEUM+YvjjRC 31 | /HNPsIbBVFyt0n7mYw== 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/httpd_app/certs/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | 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 31 | o7kYPHxnraAtNlmQEDyEQ9s= 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/httpd_app/certs/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/httpd_app/htdocs/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | PHP Test 4 | 5 | 6 | Hello world, Authenticated User!

'; 8 | ?> 9 | 10 | 11 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/nginx_app/.nginx.conf.d/user-server.conf: -------------------------------------------------------------------------------- 1 | ssl_certificate "/workspace/certs/cert.pem"; 2 | ssl_certificate_key "/workspace/certs/key.pem"; 3 | index index.php index.html; 4 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/nginx_app/certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFeTCCA2GgAwIBAgICB+UwDQYJKoZIhvcNAQELBQAwTjEaMBgGA1UEChMRUGFr 3 | ZXRvIEJ1aWxkcGFja3MxMDAuBgNVBAMTJ1Bha2V0byBCdWlsZHBhY2tzIENlcnRp 4 | ZmljYXRlIEF1dGhvcml0eTAeFw0yMTAzMDIxNjU5MjRaFw0zMTAzMDIxNjU5MjRa 5 | ME4xGjAYBgNVBAoTEVBha2V0byBCdWlsZHBhY2tzMTAwLgYDVQQDEydQYWtldG8g 6 | QnVpbGRwYWNrcyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEB 7 | AQUAA4ICDwAwggIKAoICAQDGQS7V1sKolBHl7WV19S3sDZwUCP4BR0UrZqvR2hmm 8 | v0D1tsxmVDepX0hbQOMUq9oiSsDga2uNrVfvLNC81PZF+KePgTawdIVCF6eSPZyY 9 | muVDorvd7UGpKdx1AL3Ez+QhLj9PGP1EW6nU7oD/6XzJWeRkNZWxPNP0Ev6fChfN 10 | qKXkPJYNHPrq3G7LQ6do7oaexXEOMd+lxLtUObSXyzMQn50olkxbogLC0ncNb17h 11 | 8f0YzogQnZxe0LIkXTkbq47UJcZyZVXe4Vjuf6YXP8NY8ABW380hSbI/aHR0btD1 12 | mA24ups0XGcqD/4v8LtrEFm1pBC58faDQi435hVvaiuzz9wbhAMh1J18/FbiqnkR 13 | P+l2nEQOButa1F4ClZZ989bhJboW6LSafQRJT4yAzfRuTXBzAWFYJrikdVabfnwZ 14 | z2rZrR4lgj5IklEnTk1DiJVvNP87faTY4L0CZexrjj4YRq0BLvMG7hAkJ/7/5WZK 15 | nNSJf+P7PNyDNWUPR+aN8R411PUG53Mxyi+lumi6eucmLQONCIuI2EdQ4iPP+QR4 16 | 7r1eLS/+Sxn4mifux6GcDbzTrJDHXtaqCFWRyKUdooEo7dJVceJ/lxJLpn8W/enH 17 | OJs8J9IkUjtYizNkfDniIvHQoU3mQZx6P8AzKTJ7XA5i3Xw+YUVaM/z91aQML5sz 18 | xQIDAQABo2EwXzAOBgNVHQ8BAf8EBAMCAoQwHQYDVR0lBBYwFAYIKwYBBQUHAwIG 19 | CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEwwGrd7Rto0v2qq 20 | YBRt7pucOSjzMA0GCSqGSIb3DQEBCwUAA4ICAQBHNA41hSIBvV7DNy7Winm1ls0R 21 | bICOEawuUOZnKY3Feq1XPsPj1IHaOa4TEwPyOFs89tS5Fig5jIDtpHp+f2dYRknC 22 | eLKjDBZRUWnsuHQIR0MS4k8Bp6ztMiUTdAUSiY+Xv11sa4qGo/NCQdVSzp4wBEBM 23 | ZgnPTF9jU2OjxTufTDhbvYNAbM1l8+aBdF4/88s6D5OEbp3mYhCy8t82x7FKmLee 24 | 9GcQHoZxZjdcJfX5pBtDo9nakeLVbg5PgRUbFsaZyVXQL56VhfEYiM3UzqZCDDuh 25 | L+WU0pFkg0TX1xZ6438N8WD0zg44ObKEORfEvPAxbcKa+Nb8p1WsMKJmbeDDaXib 26 | wu7A+kWa5s4rf9zlDt0Y4wVFNuO602dO6VFyZXg8dcRyjRNa/0w/l4elgOPRonbl 27 | 8P9JY1KtIkZvQ8+f7NwloSGg+/Q0j2XqTSM04TP+RQ92iSNfsm+x8gZotKdUrvUN 28 | /7sLRgJvlJoBQ+bSHveT7r1IXE0zkM8535kYD8UEQ68cqZUEDOwK8qo2n4HY5oQ3 29 | 4BTkHOAEu39Ov6MrgeiSDzINc2eBadJcb5CwTKH17gLGDeQz8H4fRKSv2+6Pty6H 30 | esKmgqCE28Xnaz3snOEYSRfnG0+o5rgrXFUd0qAjpiu/rqCOXl9TeSEUM+YvjjRC 31 | /HNPsIbBVFyt0n7mYw== 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/nginx_app/certs/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | 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 31 | o7kYPHxnraAtNlmQEDyEQ9s= 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/nginx_app/certs/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /integration/testdata/ca_cert_apps/nginx_app/htdocs/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | PHP Test 4 | 5 | 6 | Hello world, Authenticated User!

'; 8 | ?> 9 | 10 | 11 | -------------------------------------------------------------------------------- /integration/testdata/session_handler_apps/htdocs/index.php: -------------------------------------------------------------------------------- 1 | pushHandler(new Monolog\Handler\StreamHandler('php://stdout', Monolog\Logger::WARNING)); 6 | $log->addWarning('SUCCESS'); 7 | 8 | $names = $_SERVER['QUERY_STRING']; 9 | foreach (explode(",", $names) as $name) { 10 | if (extension_loaded($name)) { 11 | echo 'SUCCESS: ' . $name . ' loads.'; 12 | } 13 | else { 14 | echo 'ERROR: ' . $name . ' failed to load.'; 15 | } 16 | } 17 | ?> 18 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paketo-buildapcks/composer_app", 3 | "type": "project", 4 | "require": { 5 | "monolog/monolog": "^1.24" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/htdocs/index.php: -------------------------------------------------------------------------------- 1 | pushHandler(new Monolog\Handler\StreamHandler('php://stdout', Monolog\Logger::WARNING)); 6 | $log->addWarning('SUCCESS'); 7 | 8 | print "This is a PHP app."; 9 | ?> 10 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/psr/log/Psr/Log'), 10 | 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 11 | ); 12 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInit266999854e966522366f290f16a06673::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | return $loader; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | 11 | array ( 12 | 'Psr\\Log\\' => 8, 13 | ), 14 | 'M' => 15 | array ( 16 | 'Monolog\\' => 8, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'Psr\\Log\\' => 22 | array ( 23 | 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', 24 | ), 25 | 'Monolog\\' => 26 | array ( 27 | 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', 28 | ), 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInit266999854e966522366f290f16a06673::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInit266999854e966522366f290f16a06673::$prefixDirsPsr4; 36 | 37 | }, null, ClassLoader::class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2016 Jordi Boggiano 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "monolog/monolog", 3 | "description": "Sends your logs to files, sockets, inboxes, databases and various web services", 4 | "keywords": ["log", "logging", "psr-3"], 5 | "homepage": "http://github.com/Seldaek/monolog", 6 | "type": "library", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Jordi Boggiano", 11 | "email": "j.boggiano@seld.be", 12 | "homepage": "http://seld.be" 13 | } 14 | ], 15 | "require": { 16 | "php": ">=5.3.0", 17 | "psr/log": "~1.0" 18 | }, 19 | "require-dev": { 20 | "phpunit/phpunit": "~4.5", 21 | "graylog2/gelf-php": "~1.0", 22 | "sentry/sentry": "^0.13", 23 | "ruflin/elastica": ">=0.90 <3.0", 24 | "doctrine/couchdb": "~1.0@dev", 25 | "aws/aws-sdk-php": "^2.4.9 || ^3.0", 26 | "php-amqplib/php-amqplib": "~2.4", 27 | "swiftmailer/swiftmailer": "^5.3|^6.0", 28 | "php-console/php-console": "^3.1.3", 29 | "phpunit/phpunit-mock-objects": "2.3.0", 30 | "jakub-onderka/php-parallel-lint": "0.9" 31 | }, 32 | "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis", 33 | "suggest": { 34 | "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", 35 | "sentry/sentry": "Allow sending log messages to a Sentry server", 36 | "doctrine/couchdb": "Allow sending log messages to a CouchDB server", 37 | "ruflin/elastica": "Allow sending log messages to an Elastic Search server", 38 | "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", 39 | "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", 40 | "ext-mongo": "Allow sending log messages to a MongoDB server", 41 | "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", 42 | "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", 43 | "rollbar/rollbar": "Allow sending log messages to Rollbar", 44 | "php-console/php-console": "Allow sending log messages to Google Chrome" 45 | }, 46 | "autoload": { 47 | "psr-4": {"Monolog\\": "src/Monolog"} 48 | }, 49 | "autoload-dev": { 50 | "psr-4": {"Monolog\\": "tests/Monolog"} 51 | }, 52 | "provide": { 53 | "psr/log-implementation": "1.0.0" 54 | }, 55 | "extra": { 56 | "branch-alias": { 57 | "dev-master": "2.0.x-dev" 58 | } 59 | }, 60 | "scripts": { 61 | "test": [ 62 | "parallel-lint . --exclude vendor --exclude src/Monolog/Handler/FormattableHandlerInterface.php --exclude src/Monolog/Handler/FormattableHandlerTrait.php --exclude src/Monolog/Handler/ProcessableHandlerInterface.php --exclude src/Monolog/Handler/ProcessableHandlerTrait.php", 63 | "phpunit" 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Formats a log message according to the ChromePHP array format 18 | * 19 | * @author Christophe Coevoet 20 | */ 21 | class ChromePHPFormatter implements FormatterInterface 22 | { 23 | /** 24 | * Translates Monolog log levels to Wildfire levels. 25 | */ 26 | private $logLevels = array( 27 | Logger::DEBUG => 'log', 28 | Logger::INFO => 'info', 29 | Logger::NOTICE => 'info', 30 | Logger::WARNING => 'warn', 31 | Logger::ERROR => 'error', 32 | Logger::CRITICAL => 'error', 33 | Logger::ALERT => 'error', 34 | Logger::EMERGENCY => 'error', 35 | ); 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function format(array $record) 41 | { 42 | // Retrieve the line and file if set and remove them from the formatted extra 43 | $backtrace = 'unknown'; 44 | if (isset($record['extra']['file'], $record['extra']['line'])) { 45 | $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; 46 | unset($record['extra']['file'], $record['extra']['line']); 47 | } 48 | 49 | $message = array('message' => $record['message']); 50 | if ($record['context']) { 51 | $message['context'] = $record['context']; 52 | } 53 | if ($record['extra']) { 54 | $message['extra'] = $record['extra']; 55 | } 56 | if (count($message) === 1) { 57 | $message = reset($message); 58 | } 59 | 60 | return array( 61 | $record['channel'], 62 | $message, 63 | $backtrace, 64 | $this->logLevels[$record['level']], 65 | ); 66 | } 67 | 68 | public function formatBatch(array $records) 69 | { 70 | $formatted = array(); 71 | 72 | foreach ($records as $record) { 73 | $formatted[] = $this->format($record); 74 | } 75 | 76 | return $formatted; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | use Elastica\Document; 15 | 16 | /** 17 | * Format a log message into an Elastica Document 18 | * 19 | * @author Jelle Vink 20 | */ 21 | class ElasticaFormatter extends NormalizerFormatter 22 | { 23 | /** 24 | * @var string Elastic search index name 25 | */ 26 | protected $index; 27 | 28 | /** 29 | * @var string Elastic search document type 30 | */ 31 | protected $type; 32 | 33 | /** 34 | * @param string $index Elastic Search index name 35 | * @param string $type Elastic Search document type 36 | */ 37 | public function __construct($index, $type) 38 | { 39 | // elasticsearch requires a ISO 8601 format date with optional millisecond precision. 40 | parent::__construct('Y-m-d\TH:i:s.uP'); 41 | 42 | $this->index = $index; 43 | $this->type = $type; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function format(array $record) 50 | { 51 | $record = parent::format($record); 52 | 53 | return $this->getDocument($record); 54 | } 55 | 56 | /** 57 | * Getter index 58 | * @return string 59 | */ 60 | public function getIndex() 61 | { 62 | return $this->index; 63 | } 64 | 65 | /** 66 | * Getter type 67 | * @return string 68 | */ 69 | public function getType() 70 | { 71 | return $this->type; 72 | } 73 | 74 | /** 75 | * Convert a log message into an Elastica Document 76 | * 77 | * @param array $record Log message 78 | * @return Document 79 | */ 80 | protected function getDocument($record) 81 | { 82 | $document = new Document(); 83 | $document->setData($record); 84 | $document->setType($this->type); 85 | $document->setIndex($this->index); 86 | 87 | return $document; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | /** 15 | * formats the record to be used in the FlowdockHandler 16 | * 17 | * @author Dominik Liebler 18 | */ 19 | class FlowdockFormatter implements FormatterInterface 20 | { 21 | /** 22 | * @var string 23 | */ 24 | private $source; 25 | 26 | /** 27 | * @var string 28 | */ 29 | private $sourceEmail; 30 | 31 | /** 32 | * @param string $source 33 | * @param string $sourceEmail 34 | */ 35 | public function __construct($source, $sourceEmail) 36 | { 37 | $this->source = $source; 38 | $this->sourceEmail = $sourceEmail; 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function format(array $record) 45 | { 46 | $tags = array( 47 | '#logs', 48 | '#' . strtolower($record['level_name']), 49 | '#' . $record['channel'], 50 | ); 51 | 52 | foreach ($record['extra'] as $value) { 53 | $tags[] = '#' . $value; 54 | } 55 | 56 | $subject = sprintf( 57 | 'in %s: %s - %s', 58 | $this->source, 59 | $record['level_name'], 60 | $this->getShortMessage($record['message']) 61 | ); 62 | 63 | $record['flowdock'] = array( 64 | 'source' => $this->source, 65 | 'from_address' => $this->sourceEmail, 66 | 'subject' => $subject, 67 | 'content' => $record['message'], 68 | 'tags' => $tags, 69 | 'project' => $this->source, 70 | ); 71 | 72 | return $record; 73 | } 74 | 75 | /** 76 | * {@inheritdoc} 77 | */ 78 | public function formatBatch(array $records) 79 | { 80 | $formatted = array(); 81 | 82 | foreach ($records as $record) { 83 | $formatted[] = $this->format($record); 84 | } 85 | 86 | return $formatted; 87 | } 88 | 89 | /** 90 | * @param string $message 91 | * 92 | * @return string 93 | */ 94 | public function getShortMessage($message) 95 | { 96 | static $hasMbString; 97 | 98 | if (null === $hasMbString) { 99 | $hasMbString = function_exists('mb_strlen'); 100 | } 101 | 102 | $maxLength = 45; 103 | 104 | if ($hasMbString) { 105 | if (mb_strlen($message, 'UTF-8') > $maxLength) { 106 | $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . ' ...'; 107 | } 108 | } else { 109 | if (strlen($message) > $maxLength) { 110 | $message = substr($message, 0, $maxLength - 4) . ' ...'; 111 | } 112 | } 113 | 114 | return $message; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | /** 15 | * Class FluentdFormatter 16 | * 17 | * Serializes a log message to Fluentd unix socket protocol 18 | * 19 | * Fluentd config: 20 | * 21 | * 22 | * type unix 23 | * path /var/run/td-agent/td-agent.sock 24 | * 25 | * 26 | * Monolog setup: 27 | * 28 | * $logger = new Monolog\Logger('fluent.tag'); 29 | * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); 30 | * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); 31 | * $logger->pushHandler($fluentHandler); 32 | * 33 | * @author Andrius Putna 34 | */ 35 | class FluentdFormatter implements FormatterInterface 36 | { 37 | /** 38 | * @var bool $levelTag should message level be a part of the fluentd tag 39 | */ 40 | protected $levelTag = false; 41 | 42 | public function __construct($levelTag = false) 43 | { 44 | if (!function_exists('json_encode')) { 45 | throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); 46 | } 47 | 48 | $this->levelTag = (bool) $levelTag; 49 | } 50 | 51 | public function isUsingLevelsInTag() 52 | { 53 | return $this->levelTag; 54 | } 55 | 56 | public function format(array $record) 57 | { 58 | $tag = $record['channel']; 59 | if ($this->levelTag) { 60 | $tag .= '.' . strtolower($record['level_name']); 61 | } 62 | 63 | $message = array( 64 | 'message' => $record['message'], 65 | 'context' => $record['context'], 66 | 'extra' => $record['extra'], 67 | ); 68 | 69 | if (!$this->levelTag) { 70 | $message['level'] = $record['level']; 71 | $message['level_name'] = $record['level_name']; 72 | } 73 | 74 | return json_encode(array($tag, $record['datetime']->getTimestamp(), $message)); 75 | } 76 | 77 | public function formatBatch(array $records) 78 | { 79 | $message = ''; 80 | foreach ($records as $record) { 81 | $message .= $this->format($record); 82 | } 83 | 84 | return $message; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | /** 15 | * Interface for formatters 16 | * 17 | * @author Jordi Boggiano 18 | */ 19 | interface FormatterInterface 20 | { 21 | /** 22 | * Formats a log record. 23 | * 24 | * @param array $record A record to format 25 | * @return mixed The formatted record 26 | */ 27 | public function format(array $record); 28 | 29 | /** 30 | * Formats a set of log records. 31 | * 32 | * @param array $records A set of records to format 33 | * @return mixed The formatted set of records 34 | */ 35 | public function formatBatch(array $records); 36 | } 37 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | /** 15 | * Encodes message information into JSON in a format compatible with Loggly. 16 | * 17 | * @author Adam Pancutt 18 | */ 19 | class LogglyFormatter extends JsonFormatter 20 | { 21 | /** 22 | * Overrides the default batch mode to new lines for compatibility with the 23 | * Loggly bulk API. 24 | * 25 | * @param int $batchMode 26 | */ 27 | public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) 28 | { 29 | parent::__construct($batchMode, $appendNewline); 30 | } 31 | 32 | /** 33 | * Appends the 'timestamp' parameter for indexing by Loggly. 34 | * 35 | * @see https://www.loggly.com/docs/automated-parsing/#json 36 | * @see \Monolog\Formatter\JsonFormatter::format() 37 | */ 38 | public function format(array $record) 39 | { 40 | if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) { 41 | $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); 42 | // TODO 2.0 unset the 'datetime' parameter, retained for BC 43 | } 44 | 45 | return parent::format($record); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | use Monolog\Utils; 15 | 16 | /** 17 | * Formats a record for use with the MongoDBHandler. 18 | * 19 | * @author Florian Plattner 20 | */ 21 | class MongoDBFormatter implements FormatterInterface 22 | { 23 | private $exceptionTraceAsString; 24 | private $maxNestingLevel; 25 | 26 | /** 27 | * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 28 | * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings 29 | */ 30 | public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = true) 31 | { 32 | $this->maxNestingLevel = max($maxNestingLevel, 0); 33 | $this->exceptionTraceAsString = (bool) $exceptionTraceAsString; 34 | } 35 | 36 | /** 37 | * {@inheritDoc} 38 | */ 39 | public function format(array $record) 40 | { 41 | return $this->formatArray($record); 42 | } 43 | 44 | /** 45 | * {@inheritDoc} 46 | */ 47 | public function formatBatch(array $records) 48 | { 49 | foreach ($records as $key => $record) { 50 | $records[$key] = $this->format($record); 51 | } 52 | 53 | return $records; 54 | } 55 | 56 | protected function formatArray(array $record, $nestingLevel = 0) 57 | { 58 | if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) { 59 | foreach ($record as $name => $value) { 60 | if ($value instanceof \DateTime) { 61 | $record[$name] = $this->formatDate($value, $nestingLevel + 1); 62 | } elseif ($value instanceof \Exception) { 63 | $record[$name] = $this->formatException($value, $nestingLevel + 1); 64 | } elseif (is_array($value)) { 65 | $record[$name] = $this->formatArray($value, $nestingLevel + 1); 66 | } elseif (is_object($value)) { 67 | $record[$name] = $this->formatObject($value, $nestingLevel + 1); 68 | } 69 | } 70 | } else { 71 | $record = '[...]'; 72 | } 73 | 74 | return $record; 75 | } 76 | 77 | protected function formatObject($value, $nestingLevel) 78 | { 79 | $objectVars = get_object_vars($value); 80 | $objectVars['class'] = Utils::getClass($value); 81 | 82 | return $this->formatArray($objectVars, $nestingLevel); 83 | } 84 | 85 | protected function formatException(\Exception $exception, $nestingLevel) 86 | { 87 | $formattedException = array( 88 | 'class' => Utils::getClass($exception), 89 | 'message' => $exception->getMessage(), 90 | 'code' => $exception->getCode(), 91 | 'file' => $exception->getFile() . ':' . $exception->getLine(), 92 | ); 93 | 94 | if ($this->exceptionTraceAsString === true) { 95 | $formattedException['trace'] = $exception->getTraceAsString(); 96 | } else { 97 | $formattedException['trace'] = $exception->getTrace(); 98 | } 99 | 100 | return $this->formatArray($formattedException, $nestingLevel); 101 | } 102 | 103 | protected function formatDate(\DateTime $value, $nestingLevel) 104 | { 105 | return new \MongoDate($value->getTimestamp()); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | /** 15 | * Formats data into an associative array of scalar values. 16 | * Objects and arrays will be JSON encoded. 17 | * 18 | * @author Andrew Lawson 19 | */ 20 | class ScalarFormatter extends NormalizerFormatter 21 | { 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public function format(array $record) 26 | { 27 | foreach ($record as $key => $value) { 28 | $record[$key] = $this->normalizeValue($value); 29 | } 30 | 31 | return $record; 32 | } 33 | 34 | /** 35 | * @param mixed $value 36 | * @return mixed 37 | */ 38 | protected function normalizeValue($value) 39 | { 40 | $normalized = $this->normalize($value); 41 | 42 | if (is_array($normalized) || is_object($normalized)) { 43 | return $this->toJson($normalized, true); 44 | } 45 | 46 | return $normalized; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Formatter; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Serializes a log message according to Wildfire's header requirements 18 | * 19 | * @author Eric Clemmons (@ericclemmons) 20 | * @author Christophe Coevoet 21 | * @author Kirill chEbba Chebunin 22 | */ 23 | class WildfireFormatter extends NormalizerFormatter 24 | { 25 | const TABLE = 'table'; 26 | 27 | /** 28 | * Translates Monolog log levels to Wildfire levels. 29 | */ 30 | private $logLevels = array( 31 | Logger::DEBUG => 'LOG', 32 | Logger::INFO => 'INFO', 33 | Logger::NOTICE => 'INFO', 34 | Logger::WARNING => 'WARN', 35 | Logger::ERROR => 'ERROR', 36 | Logger::CRITICAL => 'ERROR', 37 | Logger::ALERT => 'ERROR', 38 | Logger::EMERGENCY => 'ERROR', 39 | ); 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function format(array $record) 45 | { 46 | // Retrieve the line and file if set and remove them from the formatted extra 47 | $file = $line = ''; 48 | if (isset($record['extra']['file'])) { 49 | $file = $record['extra']['file']; 50 | unset($record['extra']['file']); 51 | } 52 | if (isset($record['extra']['line'])) { 53 | $line = $record['extra']['line']; 54 | unset($record['extra']['line']); 55 | } 56 | 57 | $record = $this->normalize($record); 58 | $message = array('message' => $record['message']); 59 | $handleError = false; 60 | if ($record['context']) { 61 | $message['context'] = $record['context']; 62 | $handleError = true; 63 | } 64 | if ($record['extra']) { 65 | $message['extra'] = $record['extra']; 66 | $handleError = true; 67 | } 68 | if (count($message) === 1) { 69 | $message = reset($message); 70 | } 71 | 72 | if (isset($record['context'][self::TABLE])) { 73 | $type = 'TABLE'; 74 | $label = $record['channel'] .': '. $record['message']; 75 | $message = $record['context'][self::TABLE]; 76 | } else { 77 | $type = $this->logLevels[$record['level']]; 78 | $label = $record['channel']; 79 | } 80 | 81 | // Create JSON object describing the appearance of the message in the console 82 | $json = $this->toJson(array( 83 | array( 84 | 'Type' => $type, 85 | 'File' => $file, 86 | 'Line' => $line, 87 | 'Label' => $label, 88 | ), 89 | $message, 90 | ), $handleError); 91 | 92 | // The message itself is a serialization of the above JSON object + it's length 93 | return sprintf( 94 | '%s|%s|', 95 | strlen($json), 96 | $json 97 | ); 98 | } 99 | 100 | public function formatBatch(array $records) 101 | { 102 | throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); 103 | } 104 | 105 | protected function normalize($data, $depth = 0) 106 | { 107 | if (is_object($data) && !$data instanceof \DateTime) { 108 | return $data; 109 | } 110 | 111 | return parent::normalize($data, $depth); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\ResettableInterface; 15 | 16 | /** 17 | * Base Handler class providing the Handler structure 18 | * 19 | * Classes extending it should (in most cases) only implement write($record) 20 | * 21 | * @author Jordi Boggiano 22 | * @author Christophe Coevoet 23 | */ 24 | abstract class AbstractProcessingHandler extends AbstractHandler 25 | { 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function handle(array $record) 30 | { 31 | if (!$this->isHandling($record)) { 32 | return false; 33 | } 34 | 35 | $record = $this->processRecord($record); 36 | 37 | $record['formatted'] = $this->getFormatter()->format($record); 38 | 39 | $this->write($record); 40 | 41 | return false === $this->bubble; 42 | } 43 | 44 | /** 45 | * Writes the record down to the log of the implementing handler 46 | * 47 | * @param array $record 48 | * @return void 49 | */ 50 | abstract protected function write(array $record); 51 | 52 | /** 53 | * Processes a record. 54 | * 55 | * @param array $record 56 | * @return array 57 | */ 58 | protected function processRecord(array $record) 59 | { 60 | if ($this->processors) { 61 | foreach ($this->processors as $processor) { 62 | $record = call_user_func($processor, $record); 63 | } 64 | } 65 | 66 | return $record; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Monolog\Formatter\LineFormatter; 16 | 17 | /** 18 | * Common syslog functionality 19 | */ 20 | abstract class AbstractSyslogHandler extends AbstractProcessingHandler 21 | { 22 | protected $facility; 23 | 24 | /** 25 | * Translates Monolog log levels to syslog log priorities. 26 | */ 27 | protected $logLevels = array( 28 | Logger::DEBUG => LOG_DEBUG, 29 | Logger::INFO => LOG_INFO, 30 | Logger::NOTICE => LOG_NOTICE, 31 | Logger::WARNING => LOG_WARNING, 32 | Logger::ERROR => LOG_ERR, 33 | Logger::CRITICAL => LOG_CRIT, 34 | Logger::ALERT => LOG_ALERT, 35 | Logger::EMERGENCY => LOG_EMERG, 36 | ); 37 | 38 | /** 39 | * List of valid log facility names. 40 | */ 41 | protected $facilities = array( 42 | 'auth' => LOG_AUTH, 43 | 'authpriv' => LOG_AUTHPRIV, 44 | 'cron' => LOG_CRON, 45 | 'daemon' => LOG_DAEMON, 46 | 'kern' => LOG_KERN, 47 | 'lpr' => LOG_LPR, 48 | 'mail' => LOG_MAIL, 49 | 'news' => LOG_NEWS, 50 | 'syslog' => LOG_SYSLOG, 51 | 'user' => LOG_USER, 52 | 'uucp' => LOG_UUCP, 53 | ); 54 | 55 | /** 56 | * @param mixed $facility 57 | * @param int $level The minimum logging level at which this handler will be triggered 58 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 59 | */ 60 | public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) 61 | { 62 | parent::__construct($level, $bubble); 63 | 64 | if (!defined('PHP_WINDOWS_VERSION_BUILD')) { 65 | $this->facilities['local0'] = LOG_LOCAL0; 66 | $this->facilities['local1'] = LOG_LOCAL1; 67 | $this->facilities['local2'] = LOG_LOCAL2; 68 | $this->facilities['local3'] = LOG_LOCAL3; 69 | $this->facilities['local4'] = LOG_LOCAL4; 70 | $this->facilities['local5'] = LOG_LOCAL5; 71 | $this->facilities['local6'] = LOG_LOCAL6; 72 | $this->facilities['local7'] = LOG_LOCAL7; 73 | } else { 74 | $this->facilities['local0'] = 128; // LOG_LOCAL0 75 | $this->facilities['local1'] = 136; // LOG_LOCAL1 76 | $this->facilities['local2'] = 144; // LOG_LOCAL2 77 | $this->facilities['local3'] = 152; // LOG_LOCAL3 78 | $this->facilities['local4'] = 160; // LOG_LOCAL4 79 | $this->facilities['local5'] = 168; // LOG_LOCAL5 80 | $this->facilities['local6'] = 176; // LOG_LOCAL6 81 | $this->facilities['local7'] = 184; // LOG_LOCAL7 82 | } 83 | 84 | // convert textual description of facility to syslog constant 85 | if (array_key_exists(strtolower($facility), $this->facilities)) { 86 | $facility = $this->facilities[strtolower($facility)]; 87 | } elseif (!in_array($facility, array_values($this->facilities), true)) { 88 | throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); 89 | } 90 | 91 | $this->facility = $facility; 92 | } 93 | 94 | /** 95 | * {@inheritdoc} 96 | */ 97 | protected function getDefaultFormatter() 98 | { 99 | return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%'); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\JsonFormatter; 15 | use Monolog\Logger; 16 | 17 | /** 18 | * CouchDB handler 19 | * 20 | * @author Markus Bachmann 21 | */ 22 | class CouchDBHandler extends AbstractProcessingHandler 23 | { 24 | private $options; 25 | 26 | public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true) 27 | { 28 | $this->options = array_merge(array( 29 | 'host' => 'localhost', 30 | 'port' => 5984, 31 | 'dbname' => 'logger', 32 | 'username' => null, 33 | 'password' => null, 34 | ), $options); 35 | 36 | parent::__construct($level, $bubble); 37 | } 38 | 39 | /** 40 | * {@inheritDoc} 41 | */ 42 | protected function write(array $record) 43 | { 44 | $basicAuth = null; 45 | if ($this->options['username']) { 46 | $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); 47 | } 48 | 49 | $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname']; 50 | $context = stream_context_create(array( 51 | 'http' => array( 52 | 'method' => 'POST', 53 | 'content' => $record['formatted'], 54 | 'ignore_errors' => true, 55 | 'max_redirects' => 0, 56 | 'header' => 'Content-type: application/json', 57 | ), 58 | )); 59 | 60 | if (false === @file_get_contents($url, null, $context)) { 61 | throw new \RuntimeException(sprintf('Could not connect to %s', $url)); 62 | } 63 | } 64 | 65 | /** 66 | * {@inheritDoc} 67 | */ 68 | protected function getDefaultFormatter() 69 | { 70 | return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler\Curl; 13 | 14 | class Util 15 | { 16 | private static $retriableErrorCodes = array( 17 | CURLE_COULDNT_RESOLVE_HOST, 18 | CURLE_COULDNT_CONNECT, 19 | CURLE_HTTP_NOT_FOUND, 20 | CURLE_READ_ERROR, 21 | CURLE_OPERATION_TIMEOUTED, 22 | CURLE_HTTP_POST_ERROR, 23 | CURLE_SSL_CONNECT_ERROR, 24 | ); 25 | 26 | /** 27 | * Executes a CURL request with optional retries and exception on failure 28 | * 29 | * @param resource $ch curl handler 30 | * @throws \RuntimeException 31 | */ 32 | public static function execute($ch, $retries = 5, $closeAfterDone = true) 33 | { 34 | while ($retries--) { 35 | if (curl_exec($ch) === false) { 36 | $curlErrno = curl_errno($ch); 37 | 38 | if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { 39 | $curlError = curl_error($ch); 40 | 41 | if ($closeAfterDone) { 42 | curl_close($ch); 43 | } 44 | 45 | throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError)); 46 | } 47 | 48 | continue; 49 | } 50 | 51 | if ($closeAfterDone) { 52 | curl_close($ch); 53 | } 54 | break; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Monolog\Formatter\NormalizerFormatter; 16 | use Doctrine\CouchDB\CouchDBClient; 17 | 18 | /** 19 | * CouchDB handler for Doctrine CouchDB ODM 20 | * 21 | * @author Markus Bachmann 22 | */ 23 | class DoctrineCouchDBHandler extends AbstractProcessingHandler 24 | { 25 | private $client; 26 | 27 | public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true) 28 | { 29 | $this->client = $client; 30 | parent::__construct($level, $bubble); 31 | } 32 | 33 | /** 34 | * {@inheritDoc} 35 | */ 36 | protected function write(array $record) 37 | { 38 | $this->client->postDocument($record['formatted']); 39 | } 40 | 41 | protected function getDefaultFormatter() 42 | { 43 | return new NormalizerFormatter; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Aws\Sdk; 15 | use Aws\DynamoDb\DynamoDbClient; 16 | use Aws\DynamoDb\Marshaler; 17 | use Monolog\Formatter\ScalarFormatter; 18 | use Monolog\Logger; 19 | 20 | /** 21 | * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) 22 | * 23 | * @link https://github.com/aws/aws-sdk-php/ 24 | * @author Andrew Lawson 25 | */ 26 | class DynamoDbHandler extends AbstractProcessingHandler 27 | { 28 | const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; 29 | 30 | /** 31 | * @var DynamoDbClient 32 | */ 33 | protected $client; 34 | 35 | /** 36 | * @var string 37 | */ 38 | protected $table; 39 | 40 | /** 41 | * @var int 42 | */ 43 | protected $version; 44 | 45 | /** 46 | * @var Marshaler 47 | */ 48 | protected $marshaler; 49 | 50 | /** 51 | * @param DynamoDbClient $client 52 | * @param string $table 53 | * @param int $level 54 | * @param bool $bubble 55 | */ 56 | public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) 57 | { 58 | if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { 59 | $this->version = 3; 60 | $this->marshaler = new Marshaler; 61 | } else { 62 | $this->version = 2; 63 | } 64 | 65 | $this->client = $client; 66 | $this->table = $table; 67 | 68 | parent::__construct($level, $bubble); 69 | } 70 | 71 | /** 72 | * {@inheritdoc} 73 | */ 74 | protected function write(array $record) 75 | { 76 | $filtered = $this->filterEmptyFields($record['formatted']); 77 | if ($this->version === 3) { 78 | $formatted = $this->marshaler->marshalItem($filtered); 79 | } else { 80 | $formatted = $this->client->formatAttributes($filtered); 81 | } 82 | 83 | $this->client->putItem(array( 84 | 'TableName' => $this->table, 85 | 'Item' => $formatted, 86 | )); 87 | } 88 | 89 | /** 90 | * @param array $record 91 | * @return array 92 | */ 93 | protected function filterEmptyFields(array $record) 94 | { 95 | return array_filter($record, function ($value) { 96 | return !empty($value) || false === $value || 0 === $value; 97 | }); 98 | } 99 | 100 | /** 101 | * {@inheritdoc} 102 | */ 103 | protected function getDefaultFormatter() 104 | { 105 | return new ScalarFormatter(self::DATE_FORMAT); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\LineFormatter; 15 | use Monolog\Logger; 16 | 17 | /** 18 | * Stores to PHP error_log() handler. 19 | * 20 | * @author Elan Ruusamäe 21 | */ 22 | class ErrorLogHandler extends AbstractProcessingHandler 23 | { 24 | const OPERATING_SYSTEM = 0; 25 | const SAPI = 4; 26 | 27 | protected $messageType; 28 | protected $expandNewlines; 29 | 30 | /** 31 | * @param int $messageType Says where the error should go. 32 | * @param int $level The minimum logging level at which this handler will be triggered 33 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 34 | * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries 35 | */ 36 | public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false) 37 | { 38 | parent::__construct($level, $bubble); 39 | 40 | if (false === in_array($messageType, self::getAvailableTypes())) { 41 | $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true)); 42 | throw new \InvalidArgumentException($message); 43 | } 44 | 45 | $this->messageType = $messageType; 46 | $this->expandNewlines = $expandNewlines; 47 | } 48 | 49 | /** 50 | * @return array With all available types 51 | */ 52 | public static function getAvailableTypes() 53 | { 54 | return array( 55 | self::OPERATING_SYSTEM, 56 | self::SAPI, 57 | ); 58 | } 59 | 60 | /** 61 | * {@inheritDoc} 62 | */ 63 | protected function getDefaultFormatter() 64 | { 65 | return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%'); 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | protected function write(array $record) 72 | { 73 | if ($this->expandNewlines) { 74 | $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); 75 | foreach ($lines as $line) { 76 | error_log($line, $this->messageType); 77 | } 78 | } else { 79 | error_log((string) $record['formatted'], $this->messageType); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler\FingersCrossed; 13 | 14 | /** 15 | * Interface for activation strategies for the FingersCrossedHandler. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | interface ActivationStrategyInterface 20 | { 21 | /** 22 | * Returns whether the given record activates the handler. 23 | * 24 | * @param array $record 25 | * @return bool 26 | */ 27 | public function isHandlerActivated(array $record); 28 | } 29 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler\FingersCrossed; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Channel and Error level based monolog activation strategy. Allows to trigger activation 18 | * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except 19 | * for records of the 'sql' channel; those should trigger activation on level 'WARN'. 20 | * 21 | * Example: 22 | * 23 | * 24 | * $activationStrategy = new ChannelLevelActivationStrategy( 25 | * Logger::CRITICAL, 26 | * array( 27 | * 'request' => Logger::ALERT, 28 | * 'sensitive' => Logger::ERROR, 29 | * ) 30 | * ); 31 | * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); 32 | * 33 | * 34 | * @author Mike Meessen 35 | */ 36 | class ChannelLevelActivationStrategy implements ActivationStrategyInterface 37 | { 38 | private $defaultActionLevel; 39 | private $channelToActionLevel; 40 | 41 | /** 42 | * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any 43 | * @param array $channelToActionLevel An array that maps channel names to action levels. 44 | */ 45 | public function __construct($defaultActionLevel, $channelToActionLevel = array()) 46 | { 47 | $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); 48 | $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); 49 | } 50 | 51 | public function isHandlerActivated(array $record) 52 | { 53 | if (isset($this->channelToActionLevel[$record['channel']])) { 54 | return $record['level'] >= $this->channelToActionLevel[$record['channel']]; 55 | } 56 | 57 | return $record['level'] >= $this->defaultActionLevel; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler\FingersCrossed; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Error level based activation strategy. 18 | * 19 | * @author Johannes M. Schmitt 20 | */ 21 | class ErrorLevelActivationStrategy implements ActivationStrategyInterface 22 | { 23 | private $actionLevel; 24 | 25 | public function __construct($actionLevel) 26 | { 27 | $this->actionLevel = Logger::toMonologLevel($actionLevel); 28 | } 29 | 30 | public function isHandlerActivated(array $record) 31 | { 32 | return $record['level'] >= $this->actionLevel; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\FormatterInterface; 15 | 16 | /** 17 | * Interface to describe loggers that have a formatter 18 | * 19 | * This interface is present in monolog 1.x to ease forward compatibility. 20 | * 21 | * @author Jordi Boggiano 22 | */ 23 | interface FormattableHandlerInterface 24 | { 25 | /** 26 | * Sets the formatter. 27 | * 28 | * @param FormatterInterface $formatter 29 | * @return HandlerInterface self 30 | */ 31 | public function setFormatter(FormatterInterface $formatter): HandlerInterface; 32 | 33 | /** 34 | * Gets the formatter. 35 | * 36 | * @return FormatterInterface 37 | */ 38 | public function getFormatter(): FormatterInterface; 39 | } 40 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\FormatterInterface; 15 | use Monolog\Formatter\LineFormatter; 16 | 17 | /** 18 | * Helper trait for implementing FormattableInterface 19 | * 20 | * This trait is present in monolog 1.x to ease forward compatibility. 21 | * 22 | * @author Jordi Boggiano 23 | */ 24 | trait FormattableHandlerTrait 25 | { 26 | /** 27 | * @var FormatterInterface 28 | */ 29 | protected $formatter; 30 | 31 | /** 32 | * {@inheritdoc} 33 | * @suppress PhanTypeMismatchReturn 34 | */ 35 | public function setFormatter(FormatterInterface $formatter): HandlerInterface 36 | { 37 | $this->formatter = $formatter; 38 | 39 | return $this; 40 | } 41 | 42 | /** 43 | * {@inheritdoc} 44 | */ 45 | public function getFormatter(): FormatterInterface 46 | { 47 | if (!$this->formatter) { 48 | $this->formatter = $this->getDefaultFormatter(); 49 | } 50 | 51 | return $this->formatter; 52 | } 53 | 54 | /** 55 | * Gets the default formatter. 56 | * 57 | * Overwrite this if the LineFormatter is not a good default for your handler. 58 | */ 59 | protected function getDefaultFormatter(): FormatterInterface 60 | { 61 | return new LineFormatter(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Gelf\IMessagePublisher; 15 | use Gelf\PublisherInterface; 16 | use Gelf\Publisher; 17 | use InvalidArgumentException; 18 | use Monolog\Logger; 19 | use Monolog\Formatter\GelfMessageFormatter; 20 | 21 | /** 22 | * Handler to send messages to a Graylog2 (http://www.graylog2.org) server 23 | * 24 | * @author Matt Lehner 25 | * @author Benjamin Zikarsky 26 | */ 27 | class GelfHandler extends AbstractProcessingHandler 28 | { 29 | /** 30 | * @var Publisher the publisher object that sends the message to the server 31 | */ 32 | protected $publisher; 33 | 34 | /** 35 | * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object 36 | * @param int $level The minimum logging level at which this handler will be triggered 37 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 38 | */ 39 | public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) 40 | { 41 | parent::__construct($level, $bubble); 42 | 43 | if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) { 44 | throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance'); 45 | } 46 | 47 | $this->publisher = $publisher; 48 | } 49 | 50 | /** 51 | * {@inheritdoc} 52 | */ 53 | protected function write(array $record) 54 | { 55 | $this->publisher->publish($record['formatted']); 56 | } 57 | 58 | /** 59 | * {@inheritDoc} 60 | */ 61 | protected function getDefaultFormatter() 62 | { 63 | return new GelfMessageFormatter(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\FormatterInterface; 15 | use Monolog\ResettableInterface; 16 | 17 | /** 18 | * Forwards records to multiple handlers 19 | * 20 | * @author Lenar Lõhmus 21 | */ 22 | class GroupHandler extends AbstractHandler 23 | { 24 | protected $handlers; 25 | 26 | /** 27 | * @param array $handlers Array of Handlers. 28 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 29 | */ 30 | public function __construct(array $handlers, $bubble = true) 31 | { 32 | foreach ($handlers as $handler) { 33 | if (!$handler instanceof HandlerInterface) { 34 | throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); 35 | } 36 | } 37 | 38 | $this->handlers = $handlers; 39 | $this->bubble = $bubble; 40 | } 41 | 42 | /** 43 | * {@inheritdoc} 44 | */ 45 | public function isHandling(array $record) 46 | { 47 | foreach ($this->handlers as $handler) { 48 | if ($handler->isHandling($record)) { 49 | return true; 50 | } 51 | } 52 | 53 | return false; 54 | } 55 | 56 | /** 57 | * {@inheritdoc} 58 | */ 59 | public function handle(array $record) 60 | { 61 | if ($this->processors) { 62 | foreach ($this->processors as $processor) { 63 | $record = call_user_func($processor, $record); 64 | } 65 | } 66 | 67 | foreach ($this->handlers as $handler) { 68 | $handler->handle($record); 69 | } 70 | 71 | return false === $this->bubble; 72 | } 73 | 74 | /** 75 | * {@inheritdoc} 76 | */ 77 | public function handleBatch(array $records) 78 | { 79 | if ($this->processors) { 80 | $processed = array(); 81 | foreach ($records as $record) { 82 | foreach ($this->processors as $processor) { 83 | $record = call_user_func($processor, $record); 84 | } 85 | $processed[] = $record; 86 | } 87 | $records = $processed; 88 | } 89 | 90 | foreach ($this->handlers as $handler) { 91 | $handler->handleBatch($records); 92 | } 93 | } 94 | 95 | public function reset() 96 | { 97 | parent::reset(); 98 | 99 | foreach ($this->handlers as $handler) { 100 | if ($handler instanceof ResettableInterface) { 101 | $handler->reset(); 102 | } 103 | } 104 | } 105 | 106 | /** 107 | * {@inheritdoc} 108 | */ 109 | public function setFormatter(FormatterInterface $formatter) 110 | { 111 | foreach ($this->handlers as $handler) { 112 | $handler->setFormatter($formatter); 113 | } 114 | 115 | return $this; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\FormatterInterface; 15 | 16 | /** 17 | * Interface that all Monolog Handlers must implement 18 | * 19 | * @author Jordi Boggiano 20 | */ 21 | interface HandlerInterface 22 | { 23 | /** 24 | * Checks whether the given record will be handled by this handler. 25 | * 26 | * This is mostly done for performance reasons, to avoid calling processors for nothing. 27 | * 28 | * Handlers should still check the record levels within handle(), returning false in isHandling() 29 | * is no guarantee that handle() will not be called, and isHandling() might not be called 30 | * for a given record. 31 | * 32 | * @param array $record Partial log record containing only a level key 33 | * 34 | * @return bool 35 | */ 36 | public function isHandling(array $record); 37 | 38 | /** 39 | * Handles a record. 40 | * 41 | * All records may be passed to this method, and the handler should discard 42 | * those that it does not want to handle. 43 | * 44 | * The return value of this function controls the bubbling process of the handler stack. 45 | * Unless the bubbling is interrupted (by returning true), the Logger class will keep on 46 | * calling further handlers in the stack with a given log record. 47 | * 48 | * @param array $record The record to handle 49 | * @return bool true means that this handler handled the record, and that bubbling is not permitted. 50 | * false means the record was either not processed or that this handler allows bubbling. 51 | */ 52 | public function handle(array $record); 53 | 54 | /** 55 | * Handles a set of records at once. 56 | * 57 | * @param array $records The records to handle (an array of record arrays) 58 | */ 59 | public function handleBatch(array $records); 60 | 61 | /** 62 | * Adds a processor in the stack. 63 | * 64 | * @param callable $callback 65 | * @return self 66 | */ 67 | public function pushProcessor($callback); 68 | 69 | /** 70 | * Removes the processor on top of the stack and returns it. 71 | * 72 | * @return callable 73 | */ 74 | public function popProcessor(); 75 | 76 | /** 77 | * Sets the formatter. 78 | * 79 | * @param FormatterInterface $formatter 80 | * @return self 81 | */ 82 | public function setFormatter(FormatterInterface $formatter); 83 | 84 | /** 85 | * Gets the formatter. 86 | * 87 | * @return FormatterInterface 88 | */ 89 | public function getFormatter(); 90 | } 91 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\ResettableInterface; 15 | use Monolog\Formatter\FormatterInterface; 16 | 17 | /** 18 | * This simple wrapper class can be used to extend handlers functionality. 19 | * 20 | * Example: A custom filtering that can be applied to any handler. 21 | * 22 | * Inherit from this class and override handle() like this: 23 | * 24 | * public function handle(array $record) 25 | * { 26 | * if ($record meets certain conditions) { 27 | * return false; 28 | * } 29 | * return $this->handler->handle($record); 30 | * } 31 | * 32 | * @author Alexey Karapetov 33 | */ 34 | class HandlerWrapper implements HandlerInterface, ResettableInterface 35 | { 36 | /** 37 | * @var HandlerInterface 38 | */ 39 | protected $handler; 40 | 41 | /** 42 | * HandlerWrapper constructor. 43 | * @param HandlerInterface $handler 44 | */ 45 | public function __construct(HandlerInterface $handler) 46 | { 47 | $this->handler = $handler; 48 | } 49 | 50 | /** 51 | * {@inheritdoc} 52 | */ 53 | public function isHandling(array $record) 54 | { 55 | return $this->handler->isHandling($record); 56 | } 57 | 58 | /** 59 | * {@inheritdoc} 60 | */ 61 | public function handle(array $record) 62 | { 63 | return $this->handler->handle($record); 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function handleBatch(array $records) 70 | { 71 | return $this->handler->handleBatch($records); 72 | } 73 | 74 | /** 75 | * {@inheritdoc} 76 | */ 77 | public function pushProcessor($callback) 78 | { 79 | $this->handler->pushProcessor($callback); 80 | 81 | return $this; 82 | } 83 | 84 | /** 85 | * {@inheritdoc} 86 | */ 87 | public function popProcessor() 88 | { 89 | return $this->handler->popProcessor(); 90 | } 91 | 92 | /** 93 | * {@inheritdoc} 94 | */ 95 | public function setFormatter(FormatterInterface $formatter) 96 | { 97 | $this->handler->setFormatter($formatter); 98 | 99 | return $this; 100 | } 101 | 102 | /** 103 | * {@inheritdoc} 104 | */ 105 | public function getFormatter() 106 | { 107 | return $this->handler->getFormatter(); 108 | } 109 | 110 | public function reset() 111 | { 112 | if ($this->handler instanceof ResettableInterface) { 113 | return $this->handler->reset(); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * IFTTTHandler uses cURL to trigger IFTTT Maker actions 18 | * 19 | * Register a secret key and trigger/event name at https://ifttt.com/maker 20 | * 21 | * value1 will be the channel from monolog's Logger constructor, 22 | * value2 will be the level name (ERROR, WARNING, ..) 23 | * value3 will be the log record's message 24 | * 25 | * @author Nehal Patel 26 | */ 27 | class IFTTTHandler extends AbstractProcessingHandler 28 | { 29 | private $eventName; 30 | private $secretKey; 31 | 32 | /** 33 | * @param string $eventName The name of the IFTTT Maker event that should be triggered 34 | * @param string $secretKey A valid IFTTT secret key 35 | * @param int $level The minimum logging level at which this handler will be triggered 36 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 37 | */ 38 | public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) 39 | { 40 | $this->eventName = $eventName; 41 | $this->secretKey = $secretKey; 42 | 43 | parent::__construct($level, $bubble); 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function write(array $record) 50 | { 51 | $postData = array( 52 | "value1" => $record["channel"], 53 | "value2" => $record["level_name"], 54 | "value3" => $record["message"], 55 | ); 56 | $postString = json_encode($postData); 57 | 58 | $ch = curl_init(); 59 | curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); 60 | curl_setopt($ch, CURLOPT_POST, true); 61 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 62 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); 63 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( 64 | "Content-Type: application/json", 65 | )); 66 | 67 | Curl\Util::execute($ch); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Inspired on LogEntriesHandler. 18 | * 19 | * @author Robert Kaufmann III 20 | * @author Gabriel Machado 21 | */ 22 | class InsightOpsHandler extends SocketHandler 23 | { 24 | /** 25 | * @var string 26 | */ 27 | protected $logToken; 28 | 29 | /** 30 | * @param string $token Log token supplied by InsightOps 31 | * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. 32 | * @param bool $useSSL Whether or not SSL encryption should be used 33 | * @param int $level The minimum logging level to trigger this handler 34 | * @param bool $bubble Whether or not messages that are handled should bubble up the stack. 35 | * 36 | * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing 37 | */ 38 | public function __construct($token, $region = 'us', $useSSL = true, $level = Logger::DEBUG, $bubble = true) 39 | { 40 | if ($useSSL && !extension_loaded('openssl')) { 41 | throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for InsightOpsHandler'); 42 | } 43 | 44 | $endpoint = $useSSL 45 | ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443' 46 | : $region . '.data.logs.insight.rapid7.com:80'; 47 | 48 | parent::__construct($endpoint, $level, $bubble); 49 | $this->logToken = $token; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | * 55 | * @param array $record 56 | * @return string 57 | */ 58 | protected function generateDataStream($record) 59 | { 60 | return $this->logToken . ' ' . $record['formatted']; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * @author Robert Kaufmann III 18 | */ 19 | class LogEntriesHandler extends SocketHandler 20 | { 21 | /** 22 | * @var string 23 | */ 24 | protected $logToken; 25 | 26 | /** 27 | * @param string $token Log token supplied by LogEntries 28 | * @param bool $useSSL Whether or not SSL encryption should be used. 29 | * @param int $level The minimum logging level to trigger this handler 30 | * @param bool $bubble Whether or not messages that are handled should bubble up the stack. 31 | * 32 | * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing 33 | */ 34 | public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true, $host = 'data.logentries.com') 35 | { 36 | if ($useSSL && !extension_loaded('openssl')) { 37 | throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); 38 | } 39 | 40 | $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80'; 41 | parent::__construct($endpoint, $level, $bubble); 42 | $this->logToken = $token; 43 | } 44 | 45 | /** 46 | * {@inheritdoc} 47 | * 48 | * @param array $record 49 | * @return string 50 | */ 51 | protected function generateDataStream($record) 52 | { 53 | return $this->logToken . ' ' . $record['formatted']; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Monolog\Formatter\LogglyFormatter; 16 | 17 | /** 18 | * Sends errors to Loggly. 19 | * 20 | * @author Przemek Sobstel 21 | * @author Adam Pancutt 22 | * @author Gregory Barchard 23 | */ 24 | class LogglyHandler extends AbstractProcessingHandler 25 | { 26 | const HOST = 'logs-01.loggly.com'; 27 | const ENDPOINT_SINGLE = 'inputs'; 28 | const ENDPOINT_BATCH = 'bulk'; 29 | 30 | protected $token; 31 | 32 | protected $tag = array(); 33 | 34 | public function __construct($token, $level = Logger::DEBUG, $bubble = true) 35 | { 36 | if (!extension_loaded('curl')) { 37 | throw new \LogicException('The curl extension is needed to use the LogglyHandler'); 38 | } 39 | 40 | $this->token = $token; 41 | 42 | parent::__construct($level, $bubble); 43 | } 44 | 45 | public function setTag($tag) 46 | { 47 | $tag = !empty($tag) ? $tag : array(); 48 | $this->tag = is_array($tag) ? $tag : array($tag); 49 | } 50 | 51 | public function addTag($tag) 52 | { 53 | if (!empty($tag)) { 54 | $tag = is_array($tag) ? $tag : array($tag); 55 | $this->tag = array_unique(array_merge($this->tag, $tag)); 56 | } 57 | } 58 | 59 | protected function write(array $record) 60 | { 61 | $this->send($record["formatted"], self::ENDPOINT_SINGLE); 62 | } 63 | 64 | public function handleBatch(array $records) 65 | { 66 | $level = $this->level; 67 | 68 | $records = array_filter($records, function ($record) use ($level) { 69 | return ($record['level'] >= $level); 70 | }); 71 | 72 | if ($records) { 73 | $this->send($this->getFormatter()->formatBatch($records), self::ENDPOINT_BATCH); 74 | } 75 | } 76 | 77 | protected function send($data, $endpoint) 78 | { 79 | $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token); 80 | 81 | $headers = array('Content-Type: application/json'); 82 | 83 | if (!empty($this->tag)) { 84 | $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); 85 | } 86 | 87 | $ch = curl_init(); 88 | 89 | curl_setopt($ch, CURLOPT_URL, $url); 90 | curl_setopt($ch, CURLOPT_POST, true); 91 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 92 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 93 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 94 | 95 | Curl\Util::execute($ch); 96 | } 97 | 98 | protected function getDefaultFormatter() 99 | { 100 | return new LogglyFormatter(); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | /** 15 | * Base class for all mail handlers 16 | * 17 | * @author Gyula Sallai 18 | */ 19 | abstract class MailHandler extends AbstractProcessingHandler 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function handleBatch(array $records) 25 | { 26 | $messages = array(); 27 | 28 | foreach ($records as $record) { 29 | if ($record['level'] < $this->level) { 30 | continue; 31 | } 32 | $messages[] = $this->processRecord($record); 33 | } 34 | 35 | if (!empty($messages)) { 36 | $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); 37 | } 38 | } 39 | 40 | /** 41 | * Send a mail with the given content 42 | * 43 | * @param string $content formatted email body to be sent 44 | * @param array $records the array of log records that formed this content 45 | */ 46 | abstract protected function send($content, array $records); 47 | 48 | /** 49 | * {@inheritdoc} 50 | */ 51 | protected function write(array $record) 52 | { 53 | $this->send((string) $record['formatted'], array($record)); 54 | } 55 | 56 | protected function getHighestRecord(array $records) 57 | { 58 | $highestRecord = null; 59 | foreach ($records as $record) { 60 | if ($highestRecord === null || $highestRecord['level'] < $record['level']) { 61 | $highestRecord = $record; 62 | } 63 | } 64 | 65 | return $highestRecord; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * MandrillHandler uses cURL to send the emails to the Mandrill API 18 | * 19 | * @author Adam Nicholson 20 | */ 21 | class MandrillHandler extends MailHandler 22 | { 23 | protected $message; 24 | protected $apiKey; 25 | 26 | /** 27 | * @param string $apiKey A valid Mandrill API key 28 | * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced 29 | * @param int $level The minimum logging level at which this handler will be triggered 30 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 31 | */ 32 | public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) 33 | { 34 | parent::__construct($level, $bubble); 35 | 36 | if (!$message instanceof \Swift_Message && is_callable($message)) { 37 | $message = call_user_func($message); 38 | } 39 | if (!$message instanceof \Swift_Message) { 40 | throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); 41 | } 42 | $this->message = $message; 43 | $this->apiKey = $apiKey; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | protected function send($content, array $records) 50 | { 51 | $message = clone $this->message; 52 | $message->setBody($content); 53 | $message->setDate(time()); 54 | 55 | $ch = curl_init(); 56 | 57 | curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); 58 | curl_setopt($ch, CURLOPT_POST, 1); 59 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 60 | curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( 61 | 'key' => $this->apiKey, 62 | 'raw_message' => (string) $message, 63 | 'async' => false, 64 | ))); 65 | 66 | Curl\Util::execute($ch); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | /** 15 | * Exception can be thrown if an extension for an handler is missing 16 | * 17 | * @author Christian Bergau 18 | */ 19 | class MissingExtensionException extends \Exception 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Monolog\Formatter\NormalizerFormatter; 16 | 17 | /** 18 | * Logs to a MongoDB database. 19 | * 20 | * usage example: 21 | * 22 | * $log = new Logger('application'); 23 | * $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod"); 24 | * $log->pushHandler($mongodb); 25 | * 26 | * @author Thomas Tourlourat 27 | */ 28 | class MongoDBHandler extends AbstractProcessingHandler 29 | { 30 | protected $mongoCollection; 31 | 32 | public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true) 33 | { 34 | if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) { 35 | throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required'); 36 | } 37 | 38 | $this->mongoCollection = $mongo->selectCollection($database, $collection); 39 | 40 | parent::__construct($level, $bubble); 41 | } 42 | 43 | protected function write(array $record) 44 | { 45 | if ($this->mongoCollection instanceof \MongoDB\Collection) { 46 | $this->mongoCollection->insertOne($record["formatted"]); 47 | } else { 48 | $this->mongoCollection->save($record["formatted"]); 49 | } 50 | } 51 | 52 | /** 53 | * {@inheritDoc} 54 | */ 55 | protected function getDefaultFormatter() 56 | { 57 | return new NormalizerFormatter(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Blackhole 18 | * 19 | * Any record it can handle will be thrown away. This can be used 20 | * to put on top of an existing stack to override it temporarily. 21 | * 22 | * @author Jordi Boggiano 23 | */ 24 | class NullHandler extends AbstractHandler 25 | { 26 | /** 27 | * @param int $level The minimum logging level at which this handler will be triggered 28 | */ 29 | public function __construct($level = Logger::DEBUG) 30 | { 31 | parent::__construct($level, false); 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function handle(array $record) 38 | { 39 | if ($record['level'] < $this->level) { 40 | return false; 41 | } 42 | 43 | return true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Processor\ProcessorInterface; 15 | 16 | /** 17 | * Interface to describe loggers that have processors 18 | * 19 | * This interface is present in monolog 1.x to ease forward compatibility. 20 | * 21 | * @author Jordi Boggiano 22 | */ 23 | interface ProcessableHandlerInterface 24 | { 25 | /** 26 | * Adds a processor in the stack. 27 | * 28 | * @param ProcessorInterface|callable $callback 29 | * @return HandlerInterface self 30 | */ 31 | public function pushProcessor($callback): HandlerInterface; 32 | 33 | /** 34 | * Removes the processor on top of the stack and returns it. 35 | * 36 | * @throws \LogicException In case the processor stack is empty 37 | * @return callable 38 | */ 39 | public function popProcessor(): callable; 40 | } 41 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\ResettableInterface; 15 | 16 | /** 17 | * Helper trait for implementing ProcessableInterface 18 | * 19 | * This trait is present in monolog 1.x to ease forward compatibility. 20 | * 21 | * @author Jordi Boggiano 22 | */ 23 | trait ProcessableHandlerTrait 24 | { 25 | /** 26 | * @var callable[] 27 | */ 28 | protected $processors = []; 29 | 30 | /** 31 | * {@inheritdoc} 32 | * @suppress PhanTypeMismatchReturn 33 | */ 34 | public function pushProcessor($callback): HandlerInterface 35 | { 36 | array_unshift($this->processors, $callback); 37 | 38 | return $this; 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function popProcessor(): callable 45 | { 46 | if (!$this->processors) { 47 | throw new \LogicException('You tried to pop from an empty processor stack.'); 48 | } 49 | 50 | return array_shift($this->processors); 51 | } 52 | 53 | /** 54 | * Processes a record. 55 | */ 56 | protected function processRecord(array $record): array 57 | { 58 | foreach ($this->processors as $processor) { 59 | $record = $processor($record); 60 | } 61 | 62 | return $record; 63 | } 64 | 65 | protected function resetProcessors(): void 66 | { 67 | foreach ($this->processors as $processor) { 68 | if ($processor instanceof ResettableInterface) { 69 | $processor->reset(); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Psr\Log\LoggerInterface; 16 | 17 | /** 18 | * Proxies log messages to an existing PSR-3 compliant logger. 19 | * 20 | * @author Michael Moussa 21 | */ 22 | class PsrHandler extends AbstractHandler 23 | { 24 | /** 25 | * PSR-3 compliant logger 26 | * 27 | * @var LoggerInterface 28 | */ 29 | protected $logger; 30 | 31 | /** 32 | * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied 33 | * @param int $level The minimum logging level at which this handler will be triggered 34 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 35 | */ 36 | public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true) 37 | { 38 | parent::__construct($level, $bubble); 39 | 40 | $this->logger = $logger; 41 | } 42 | 43 | /** 44 | * {@inheritDoc} 45 | */ 46 | public function handle(array $record) 47 | { 48 | if (!$this->isHandling($record)) { 49 | return false; 50 | } 51 | 52 | $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); 53 | 54 | return false === $this->bubble; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Formatter\LineFormatter; 15 | use Monolog\Logger; 16 | 17 | /** 18 | * Logs to a Redis key using rpush 19 | * 20 | * usage example: 21 | * 22 | * $log = new Logger('application'); 23 | * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod"); 24 | * $log->pushHandler($redis); 25 | * 26 | * @author Thomas Tourlourat 27 | */ 28 | class RedisHandler extends AbstractProcessingHandler 29 | { 30 | private $redisClient; 31 | private $redisKey; 32 | protected $capSize; 33 | 34 | /** 35 | * @param \Predis\Client|\Redis $redis The redis instance 36 | * @param string $key The key name to push records to 37 | * @param int $level The minimum logging level at which this handler will be triggered 38 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 39 | * @param int $capSize Number of entries to limit list size to 40 | */ 41 | public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) 42 | { 43 | if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { 44 | throw new \InvalidArgumentException('Predis\Client or Redis instance required'); 45 | } 46 | 47 | $this->redisClient = $redis; 48 | $this->redisKey = $key; 49 | $this->capSize = $capSize; 50 | 51 | parent::__construct($level, $bubble); 52 | } 53 | 54 | /** 55 | * {@inheritDoc} 56 | */ 57 | protected function write(array $record) 58 | { 59 | if ($this->capSize) { 60 | $this->writeCapped($record); 61 | } else { 62 | $this->redisClient->rpush($this->redisKey, $record["formatted"]); 63 | } 64 | } 65 | 66 | /** 67 | * Write and cap the collection 68 | * Writes the record to the redis list and caps its 69 | * 70 | * @param array $record associative record array 71 | * @return void 72 | */ 73 | protected function writeCapped(array $record) 74 | { 75 | if ($this->redisClient instanceof \Redis) { 76 | $this->redisClient->multi() 77 | ->rpush($this->redisKey, $record["formatted"]) 78 | ->ltrim($this->redisKey, -$this->capSize, -1) 79 | ->exec(); 80 | } else { 81 | $redisKey = $this->redisKey; 82 | $capSize = $this->capSize; 83 | $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { 84 | $tx->rpush($redisKey, $record["formatted"]); 85 | $tx->ltrim($redisKey, -$capSize, -1); 86 | }); 87 | } 88 | } 89 | 90 | /** 91 | * {@inheritDoc} 92 | */ 93 | protected function getDefaultFormatter() 94 | { 95 | return new LineFormatter(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | /** 15 | * Sampling handler 16 | * 17 | * A sampled event stream can be useful for logging high frequency events in 18 | * a production environment where you only need an idea of what is happening 19 | * and are not concerned with capturing every occurrence. Since the decision to 20 | * handle or not handle a particular event is determined randomly, the 21 | * resulting sampled log is not guaranteed to contain 1/N of the events that 22 | * occurred in the application, but based on the Law of large numbers, it will 23 | * tend to be close to this ratio with a large number of attempts. 24 | * 25 | * @author Bryan Davis 26 | * @author Kunal Mehta 27 | */ 28 | class SamplingHandler extends AbstractHandler 29 | { 30 | /** 31 | * @var callable|HandlerInterface $handler 32 | */ 33 | protected $handler; 34 | 35 | /** 36 | * @var int $factor 37 | */ 38 | protected $factor; 39 | 40 | /** 41 | * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). 42 | * @param int $factor Sample factor 43 | */ 44 | public function __construct($handler, $factor) 45 | { 46 | parent::__construct(); 47 | $this->handler = $handler; 48 | $this->factor = $factor; 49 | 50 | if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { 51 | throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); 52 | } 53 | } 54 | 55 | public function isHandling(array $record) 56 | { 57 | return $this->handler->isHandling($record); 58 | } 59 | 60 | public function handle(array $record) 61 | { 62 | if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { 63 | // The same logic as in FingersCrossedHandler 64 | if (!$this->handler instanceof HandlerInterface) { 65 | $this->handler = call_user_func($this->handler, $record, $this); 66 | if (!$this->handler instanceof HandlerInterface) { 67 | throw new \RuntimeException("The factory callable should return a HandlerInterface"); 68 | } 69 | } 70 | 71 | if ($this->processors) { 72 | foreach ($this->processors as $processor) { 73 | $record = call_user_func($processor, $record); 74 | } 75 | } 76 | 77 | $this->handler->handle($record); 78 | } 79 | 80 | return false === $this->bubble; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Sends notifications through Slack's Slackbot 18 | * 19 | * @author Haralan Dobrev 20 | * @see https://slack.com/apps/A0F81R8ET-slackbot 21 | * @deprecated According to Slack the API used on this handler it is deprecated. 22 | * Therefore this handler will be removed on 2.x 23 | * Slack suggests to use webhooks instead. Please contact slack for more information. 24 | */ 25 | class SlackbotHandler extends AbstractProcessingHandler 26 | { 27 | /** 28 | * The slug of the Slack team 29 | * @var string 30 | */ 31 | private $slackTeam; 32 | 33 | /** 34 | * Slackbot token 35 | * @var string 36 | */ 37 | private $token; 38 | 39 | /** 40 | * Slack channel name 41 | * @var string 42 | */ 43 | private $channel; 44 | 45 | /** 46 | * @param string $slackTeam Slack team slug 47 | * @param string $token Slackbot token 48 | * @param string $channel Slack channel (encoded ID or name) 49 | * @param int $level The minimum logging level at which this handler will be triggered 50 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 51 | */ 52 | public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true) 53 | { 54 | @trigger_error('SlackbotHandler is deprecated and will be removed on 2.x', E_USER_DEPRECATED); 55 | parent::__construct($level, $bubble); 56 | 57 | $this->slackTeam = $slackTeam; 58 | $this->token = $token; 59 | $this->channel = $channel; 60 | } 61 | 62 | /** 63 | * {@inheritdoc} 64 | * 65 | * @param array $record 66 | */ 67 | protected function write(array $record) 68 | { 69 | $slackbotUrl = sprintf( 70 | 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', 71 | $this->slackTeam, 72 | $this->token, 73 | $this->channel 74 | ); 75 | 76 | $ch = curl_init(); 77 | curl_setopt($ch, CURLOPT_URL, $slackbotUrl); 78 | curl_setopt($ch, CURLOPT_POST, true); 79 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 80 | curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); 81 | 82 | Curl\Util::execute($ch); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Logs to syslog service. 18 | * 19 | * usage example: 20 | * 21 | * $log = new Logger('application'); 22 | * $syslog = new SyslogHandler('myfacility', 'local6'); 23 | * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); 24 | * $syslog->setFormatter($formatter); 25 | * $log->pushHandler($syslog); 26 | * 27 | * @author Sven Paulus 28 | */ 29 | class SyslogHandler extends AbstractSyslogHandler 30 | { 31 | protected $ident; 32 | protected $logopts; 33 | 34 | /** 35 | * @param string $ident 36 | * @param mixed $facility 37 | * @param int $level The minimum logging level at which this handler will be triggered 38 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 39 | * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID 40 | */ 41 | public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID) 42 | { 43 | parent::__construct($facility, $level, $bubble); 44 | 45 | $this->ident = $ident; 46 | $this->logopts = $logopts; 47 | } 48 | 49 | /** 50 | * {@inheritdoc} 51 | */ 52 | public function close() 53 | { 54 | closelog(); 55 | } 56 | 57 | /** 58 | * {@inheritdoc} 59 | */ 60 | protected function write(array $record) 61 | { 62 | if (!openlog($this->ident, $this->logopts, $this->facility)) { 63 | throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"'); 64 | } 65 | syslog($this->logLevels[$record['level']], (string) $record['formatted']); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler\SyslogUdp; 13 | 14 | class UdpSocket 15 | { 16 | const DATAGRAM_MAX_LENGTH = 65023; 17 | 18 | protected $ip; 19 | protected $port; 20 | protected $socket; 21 | 22 | public function __construct($ip, $port = 514) 23 | { 24 | $this->ip = $ip; 25 | $this->port = $port; 26 | $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); 27 | } 28 | 29 | public function write($line, $header = "") 30 | { 31 | $this->send($this->assembleMessage($line, $header)); 32 | } 33 | 34 | public function close() 35 | { 36 | if (is_resource($this->socket)) { 37 | socket_close($this->socket); 38 | $this->socket = null; 39 | } 40 | } 41 | 42 | protected function send($chunk) 43 | { 44 | if (!is_resource($this->socket)) { 45 | throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore'); 46 | } 47 | socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port); 48 | } 49 | 50 | protected function assembleMessage($line, $header) 51 | { 52 | $chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header); 53 | 54 | return $header . substr($line, 0, $chunkSize); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | use Monolog\Logger; 15 | use Monolog\Handler\SyslogUdp\UdpSocket; 16 | 17 | /** 18 | * A Handler for logging to a remote syslogd server. 19 | * 20 | * @author Jesper Skovgaard Nielsen 21 | * @author Dominik Kukacka 22 | */ 23 | class SyslogUdpHandler extends AbstractSyslogHandler 24 | { 25 | const RFC3164 = 0; 26 | const RFC5424 = 1; 27 | 28 | private $dateFormats = array( 29 | self::RFC3164 => 'M d H:i:s', 30 | self::RFC5424 => \DateTime::RFC3339, 31 | ); 32 | 33 | protected $socket; 34 | protected $ident; 35 | protected $rfc; 36 | 37 | /** 38 | * @param string $host 39 | * @param int $port 40 | * @param mixed $facility 41 | * @param int $level The minimum logging level at which this handler will be triggered 42 | * @param bool $bubble Whether the messages that are handled can bubble up the stack or not 43 | * @param string $ident Program name or tag for each log message. 44 | * @param int $rfc RFC to format the message for. 45 | */ 46 | public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php', $rfc = self::RFC5424) 47 | { 48 | parent::__construct($facility, $level, $bubble); 49 | 50 | $this->ident = $ident; 51 | $this->rfc = $rfc; 52 | 53 | $this->socket = new UdpSocket($host, $port ?: 514); 54 | } 55 | 56 | protected function write(array $record) 57 | { 58 | $lines = $this->splitMessageIntoLines($record['formatted']); 59 | 60 | $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]); 61 | 62 | foreach ($lines as $line) { 63 | $this->socket->write($line, $header); 64 | } 65 | } 66 | 67 | public function close() 68 | { 69 | $this->socket->close(); 70 | } 71 | 72 | private function splitMessageIntoLines($message) 73 | { 74 | if (is_array($message)) { 75 | $message = implode("\n", $message); 76 | } 77 | 78 | return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY); 79 | } 80 | 81 | /** 82 | * Make common syslog header (see rfc5424 or rfc3164) 83 | */ 84 | protected function makeCommonSyslogHeader($severity) 85 | { 86 | $priority = $severity + $this->facility; 87 | 88 | if (!$pid = getmypid()) { 89 | $pid = '-'; 90 | } 91 | 92 | if (!$hostname = gethostname()) { 93 | $hostname = '-'; 94 | } 95 | 96 | $date = $this->getDateTime(); 97 | 98 | if ($this->rfc === self::RFC3164) { 99 | return "<$priority>" . 100 | $date . " " . 101 | $hostname . " " . 102 | $this->ident . "[" . $pid . "]: "; 103 | } else { 104 | return "<$priority>1 " . 105 | $date . " " . 106 | $hostname . " " . 107 | $this->ident . " " . 108 | $pid . " - - "; 109 | } 110 | } 111 | 112 | protected function getDateTime() 113 | { 114 | return date($this->dateFormats[$this->rfc]); 115 | } 116 | 117 | /** 118 | * Inject your own socket, mainly used for testing 119 | */ 120 | public function setSocket($socket) 121 | { 122 | $this->socket = $socket; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Handler; 13 | 14 | /** 15 | * Forwards records to multiple handlers suppressing failures of each handler 16 | * and continuing through to give every handler a chance to succeed. 17 | * 18 | * @author Craig D'Amelio 19 | */ 20 | class WhatFailureGroupHandler extends GroupHandler 21 | { 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public function handle(array $record) 26 | { 27 | if ($this->processors) { 28 | foreach ($this->processors as $processor) { 29 | $record = call_user_func($processor, $record); 30 | } 31 | } 32 | 33 | foreach ($this->handlers as $handler) { 34 | try { 35 | $handler->handle($record); 36 | } catch (\Exception $e) { 37 | // What failure? 38 | } catch (\Throwable $e) { 39 | // What failure? 40 | } 41 | } 42 | 43 | return false === $this->bubble; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function handleBatch(array $records) 50 | { 51 | if ($this->processors) { 52 | $processed = array(); 53 | foreach ($records as $record) { 54 | foreach ($this->processors as $processor) { 55 | $record = call_user_func($processor, $record); 56 | } 57 | $processed[] = $record; 58 | } 59 | $records = $processed; 60 | } 61 | 62 | foreach ($this->handlers as $handler) { 63 | try { 64 | $handler->handleBatch($records); 65 | } catch (\Exception $e) { 66 | // What failure? 67 | } catch (\Throwable $e) { 68 | // What failure? 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | namespace Monolog\Handler; 12 | 13 | use Monolog\Formatter\NormalizerFormatter; 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Handler sending logs to Zend Monitor 18 | * 19 | * @author Christian Bergau 20 | * @author Jason Davis 21 | */ 22 | class ZendMonitorHandler extends AbstractProcessingHandler 23 | { 24 | /** 25 | * Monolog level / ZendMonitor Custom Event priority map 26 | * 27 | * @var array 28 | */ 29 | protected $levelMap = array(); 30 | 31 | /** 32 | * Construct 33 | * 34 | * @param int $level 35 | * @param bool $bubble 36 | * @throws MissingExtensionException 37 | */ 38 | public function __construct($level = Logger::DEBUG, $bubble = true) 39 | { 40 | if (!function_exists('zend_monitor_custom_event')) { 41 | throw new MissingExtensionException( 42 | 'You must have Zend Server installed with Zend Monitor enabled in order to use this handler' 43 | ); 44 | } 45 | //zend monitor constants are not defined if zend monitor is not enabled. 46 | $this->levelMap = array( 47 | Logger::DEBUG => \ZEND_MONITOR_EVENT_SEVERITY_INFO, 48 | Logger::INFO => \ZEND_MONITOR_EVENT_SEVERITY_INFO, 49 | Logger::NOTICE => \ZEND_MONITOR_EVENT_SEVERITY_INFO, 50 | Logger::WARNING => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, 51 | Logger::ERROR => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, 52 | Logger::CRITICAL => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, 53 | Logger::ALERT => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, 54 | Logger::EMERGENCY => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, 55 | ); 56 | parent::__construct($level, $bubble); 57 | } 58 | 59 | /** 60 | * {@inheritdoc} 61 | */ 62 | protected function write(array $record) 63 | { 64 | $this->writeZendMonitorCustomEvent( 65 | Logger::getLevelName($record['level']), 66 | $record['message'], 67 | $record['formatted'], 68 | $this->levelMap[$record['level']] 69 | ); 70 | } 71 | 72 | /** 73 | * Write to Zend Monitor Events 74 | * @param string $type Text displayed in "Class Name (custom)" field 75 | * @param string $message Text displayed in "Error String" 76 | * @param mixed $formatted Displayed in Custom Variables tab 77 | * @param int $severity Set the event severity level (-1,0,1) 78 | */ 79 | protected function writeZendMonitorCustomEvent($type, $message, $formatted, $severity) 80 | { 81 | zend_monitor_custom_event($type, $message, $formatted, $severity); 82 | } 83 | 84 | /** 85 | * {@inheritdoc} 86 | */ 87 | public function getDefaultFormatter() 88 | { 89 | return new NormalizerFormatter(); 90 | } 91 | 92 | /** 93 | * Get the level map 94 | * 95 | * @return array 96 | */ 97 | public function getLevelMap() 98 | { 99 | return $this->levelMap; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Injects Git branch and Git commit SHA in all records 18 | * 19 | * @author Nick Otter 20 | * @author Jordi Boggiano 21 | */ 22 | class GitProcessor implements ProcessorInterface 23 | { 24 | private $level; 25 | private static $cache; 26 | 27 | public function __construct($level = Logger::DEBUG) 28 | { 29 | $this->level = Logger::toMonologLevel($level); 30 | } 31 | 32 | /** 33 | * @param array $record 34 | * @return array 35 | */ 36 | public function __invoke(array $record) 37 | { 38 | // return if the level is not high enough 39 | if ($record['level'] < $this->level) { 40 | return $record; 41 | } 42 | 43 | $record['extra']['git'] = self::getGitInfo(); 44 | 45 | return $record; 46 | } 47 | 48 | private static function getGitInfo() 49 | { 50 | if (self::$cache) { 51 | return self::$cache; 52 | } 53 | 54 | $branches = `git branch -v --no-abbrev`; 55 | if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { 56 | return self::$cache = array( 57 | 'branch' => $matches[1], 58 | 'commit' => $matches[2], 59 | ); 60 | } 61 | 62 | return self::$cache = array(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Injects memory_get_peak_usage in all records 16 | * 17 | * @see Monolog\Processor\MemoryProcessor::__construct() for options 18 | * @author Rob Jensen 19 | */ 20 | class MemoryPeakUsageProcessor extends MemoryProcessor 21 | { 22 | /** 23 | * @param array $record 24 | * @return array 25 | */ 26 | public function __invoke(array $record) 27 | { 28 | $bytes = memory_get_peak_usage($this->realUsage); 29 | $formatted = $this->formatBytes($bytes); 30 | 31 | $record['extra']['memory_peak_usage'] = $formatted; 32 | 33 | return $record; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Some methods that are common for all memory processors 16 | * 17 | * @author Rob Jensen 18 | */ 19 | abstract class MemoryProcessor implements ProcessorInterface 20 | { 21 | /** 22 | * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. 23 | */ 24 | protected $realUsage; 25 | 26 | /** 27 | * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) 28 | */ 29 | protected $useFormatting; 30 | 31 | /** 32 | * @param bool $realUsage Set this to true to get the real size of memory allocated from system. 33 | * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) 34 | */ 35 | public function __construct($realUsage = true, $useFormatting = true) 36 | { 37 | $this->realUsage = (bool) $realUsage; 38 | $this->useFormatting = (bool) $useFormatting; 39 | } 40 | 41 | /** 42 | * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is 43 | * 44 | * @param int $bytes 45 | * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is 46 | */ 47 | protected function formatBytes($bytes) 48 | { 49 | $bytes = (int) $bytes; 50 | 51 | if (!$this->useFormatting) { 52 | return $bytes; 53 | } 54 | 55 | if ($bytes > 1024 * 1024) { 56 | return round($bytes / 1024 / 1024, 2).' MB'; 57 | } elseif ($bytes > 1024) { 58 | return round($bytes / 1024, 2).' KB'; 59 | } 60 | 61 | return $bytes . ' B'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Injects memory_get_usage in all records 16 | * 17 | * @see Monolog\Processor\MemoryProcessor::__construct() for options 18 | * @author Rob Jensen 19 | */ 20 | class MemoryUsageProcessor extends MemoryProcessor 21 | { 22 | /** 23 | * @param array $record 24 | * @return array 25 | */ 26 | public function __invoke(array $record) 27 | { 28 | $bytes = memory_get_usage($this->realUsage); 29 | $formatted = $this->formatBytes($bytes); 30 | 31 | $record['extra']['memory_usage'] = $formatted; 32 | 33 | return $record; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | use Monolog\Logger; 15 | 16 | /** 17 | * Injects Hg branch and Hg revision number in all records 18 | * 19 | * @author Jonathan A. Schweder 20 | */ 21 | class MercurialProcessor implements ProcessorInterface 22 | { 23 | private $level; 24 | private static $cache; 25 | 26 | public function __construct($level = Logger::DEBUG) 27 | { 28 | $this->level = Logger::toMonologLevel($level); 29 | } 30 | 31 | /** 32 | * @param array $record 33 | * @return array 34 | */ 35 | public function __invoke(array $record) 36 | { 37 | // return if the level is not high enough 38 | if ($record['level'] < $this->level) { 39 | return $record; 40 | } 41 | 42 | $record['extra']['hg'] = self::getMercurialInfo(); 43 | 44 | return $record; 45 | } 46 | 47 | private static function getMercurialInfo() 48 | { 49 | if (self::$cache) { 50 | return self::$cache; 51 | } 52 | 53 | $result = explode(' ', trim(`hg id -nb`)); 54 | if (count($result) >= 3) { 55 | return self::$cache = array( 56 | 'branch' => $result[1], 57 | 'revision' => $result[2], 58 | ); 59 | } 60 | 61 | return self::$cache = array(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Adds value of getmypid into records 16 | * 17 | * @author Andreas Hörnicke 18 | */ 19 | class ProcessIdProcessor implements ProcessorInterface 20 | { 21 | /** 22 | * @param array $record 23 | * @return array 24 | */ 25 | public function __invoke(array $record) 26 | { 27 | $record['extra']['process_id'] = getmypid(); 28 | 29 | return $record; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * An optional interface to allow labelling Monolog processors. 16 | * 17 | * @author Nicolas Grekas 18 | */ 19 | interface ProcessorInterface 20 | { 21 | /** 22 | * @return array The processed records 23 | */ 24 | public function __invoke(array $records); 25 | } 26 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | use Monolog\Utils; 15 | 16 | /** 17 | * Processes a record's message according to PSR-3 rules 18 | * 19 | * It replaces {foo} with the value from $context['foo'] 20 | * 21 | * @author Jordi Boggiano 22 | */ 23 | class PsrLogMessageProcessor implements ProcessorInterface 24 | { 25 | /** 26 | * @param array $record 27 | * @return array 28 | */ 29 | public function __invoke(array $record) 30 | { 31 | if (false === strpos($record['message'], '{')) { 32 | return $record; 33 | } 34 | 35 | $replacements = array(); 36 | foreach ($record['context'] as $key => $val) { 37 | if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { 38 | $replacements['{'.$key.'}'] = $val; 39 | } elseif (is_object($val)) { 40 | $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']'; 41 | } else { 42 | $replacements['{'.$key.'}'] = '['.gettype($val).']'; 43 | } 44 | } 45 | 46 | $record['message'] = strtr($record['message'], $replacements); 47 | 48 | return $record; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Adds a tags array into record 16 | * 17 | * @author Martijn Riemers 18 | */ 19 | class TagProcessor implements ProcessorInterface 20 | { 21 | private $tags; 22 | 23 | public function __construct(array $tags = array()) 24 | { 25 | $this->setTags($tags); 26 | } 27 | 28 | public function addTags(array $tags = array()) 29 | { 30 | $this->tags = array_merge($this->tags, $tags); 31 | } 32 | 33 | public function setTags(array $tags = array()) 34 | { 35 | $this->tags = $tags; 36 | } 37 | 38 | public function __invoke(array $record) 39 | { 40 | $record['extra']['tags'] = $this->tags; 41 | 42 | return $record; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | use Monolog\ResettableInterface; 15 | 16 | /** 17 | * Adds a unique identifier into records 18 | * 19 | * @author Simon Mönch 20 | */ 21 | class UidProcessor implements ProcessorInterface, ResettableInterface 22 | { 23 | private $uid; 24 | 25 | public function __construct($length = 7) 26 | { 27 | if (!is_int($length) || $length > 32 || $length < 1) { 28 | throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); 29 | } 30 | 31 | 32 | $this->uid = $this->generateUid($length); 33 | } 34 | 35 | public function __invoke(array $record) 36 | { 37 | $record['extra']['uid'] = $this->uid; 38 | 39 | return $record; 40 | } 41 | 42 | /** 43 | * @return string 44 | */ 45 | public function getUid() 46 | { 47 | return $this->uid; 48 | } 49 | 50 | public function reset() 51 | { 52 | $this->uid = $this->generateUid(strlen($this->uid)); 53 | } 54 | 55 | private function generateUid($length) 56 | { 57 | return substr(hash('md5', uniqid('', true)), 0, $length); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog\Processor; 13 | 14 | /** 15 | * Injects url/method and remote IP of the current web request in all records 16 | * 17 | * @author Jordi Boggiano 18 | */ 19 | class WebProcessor implements ProcessorInterface 20 | { 21 | /** 22 | * @var array|\ArrayAccess 23 | */ 24 | protected $serverData; 25 | 26 | /** 27 | * Default fields 28 | * 29 | * Array is structured as [key in record.extra => key in $serverData] 30 | * 31 | * @var array 32 | */ 33 | protected $extraFields = array( 34 | 'url' => 'REQUEST_URI', 35 | 'ip' => 'REMOTE_ADDR', 36 | 'http_method' => 'REQUEST_METHOD', 37 | 'server' => 'SERVER_NAME', 38 | 'referrer' => 'HTTP_REFERER', 39 | ); 40 | 41 | /** 42 | * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data 43 | * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer 44 | */ 45 | public function __construct($serverData = null, array $extraFields = null) 46 | { 47 | if (null === $serverData) { 48 | $this->serverData = &$_SERVER; 49 | } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { 50 | $this->serverData = $serverData; 51 | } else { 52 | throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); 53 | } 54 | 55 | if (null !== $extraFields) { 56 | if (isset($extraFields[0])) { 57 | foreach (array_keys($this->extraFields) as $fieldName) { 58 | if (!in_array($fieldName, $extraFields)) { 59 | unset($this->extraFields[$fieldName]); 60 | } 61 | } 62 | } else { 63 | $this->extraFields = $extraFields; 64 | } 65 | } 66 | } 67 | 68 | /** 69 | * @param array $record 70 | * @return array 71 | */ 72 | public function __invoke(array $record) 73 | { 74 | // skip processing if for some reason request data 75 | // is not present (CLI or wonky SAPIs) 76 | if (!isset($this->serverData['REQUEST_URI'])) { 77 | return $record; 78 | } 79 | 80 | $record['extra'] = $this->appendExtraFields($record['extra']); 81 | 82 | return $record; 83 | } 84 | 85 | /** 86 | * @param string $extraName 87 | * @param string $serverName 88 | * @return $this 89 | */ 90 | public function addExtraField($extraName, $serverName) 91 | { 92 | $this->extraFields[$extraName] = $serverName; 93 | 94 | return $this; 95 | } 96 | 97 | /** 98 | * @param array $extra 99 | * @return array 100 | */ 101 | private function appendExtraFields(array $extra) 102 | { 103 | foreach ($this->extraFields as $extraName => $serverName) { 104 | $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null; 105 | } 106 | 107 | if (isset($this->serverData['UNIQUE_ID'])) { 108 | $extra['unique_id'] = $this->serverData['UNIQUE_ID']; 109 | } 110 | 111 | return $extra; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/ResettableInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog; 13 | 14 | /** 15 | * Handler or Processor implementing this interface will be reset when Logger::reset() is called. 16 | * 17 | * Resetting ends a log cycle gets them back to their initial state. 18 | * 19 | * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal 20 | * state, and getting it back to a state in which it can receive log records again. 21 | * 22 | * This is useful in case you want to avoid logs leaking between two requests or jobs when you 23 | * have a long running process like a worker or an application server serving multiple requests 24 | * in one process. 25 | * 26 | * @author Grégoire Pineau 27 | */ 28 | interface ResettableInterface 29 | { 30 | public function reset(); 31 | } 32 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/monolog/monolog/src/Monolog/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Monolog; 13 | 14 | class Utils 15 | { 16 | /** 17 | * @internal 18 | */ 19 | public static function getClass($object) 20 | { 21 | $class = \get_class($object); 22 | 23 | return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 PHP Framework Interoperability Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/Psr/Log/AbstractLogger.php: -------------------------------------------------------------------------------- 1 | log(LogLevel::EMERGENCY, $message, $context); 25 | } 26 | 27 | /** 28 | * Action must be taken immediately. 29 | * 30 | * Example: Entire website down, database unavailable, etc. This should 31 | * trigger the SMS alerts and wake you up. 32 | * 33 | * @param string $message 34 | * @param array $context 35 | * 36 | * @return void 37 | */ 38 | public function alert($message, array $context = array()) 39 | { 40 | $this->log(LogLevel::ALERT, $message, $context); 41 | } 42 | 43 | /** 44 | * Critical conditions. 45 | * 46 | * Example: Application component unavailable, unexpected exception. 47 | * 48 | * @param string $message 49 | * @param array $context 50 | * 51 | * @return void 52 | */ 53 | public function critical($message, array $context = array()) 54 | { 55 | $this->log(LogLevel::CRITICAL, $message, $context); 56 | } 57 | 58 | /** 59 | * Runtime errors that do not require immediate action but should typically 60 | * be logged and monitored. 61 | * 62 | * @param string $message 63 | * @param array $context 64 | * 65 | * @return void 66 | */ 67 | public function error($message, array $context = array()) 68 | { 69 | $this->log(LogLevel::ERROR, $message, $context); 70 | } 71 | 72 | /** 73 | * Exceptional occurrences that are not errors. 74 | * 75 | * Example: Use of deprecated APIs, poor use of an API, undesirable things 76 | * that are not necessarily wrong. 77 | * 78 | * @param string $message 79 | * @param array $context 80 | * 81 | * @return void 82 | */ 83 | public function warning($message, array $context = array()) 84 | { 85 | $this->log(LogLevel::WARNING, $message, $context); 86 | } 87 | 88 | /** 89 | * Normal but significant events. 90 | * 91 | * @param string $message 92 | * @param array $context 93 | * 94 | * @return void 95 | */ 96 | public function notice($message, array $context = array()) 97 | { 98 | $this->log(LogLevel::NOTICE, $message, $context); 99 | } 100 | 101 | /** 102 | * Interesting events. 103 | * 104 | * Example: User logs in, SQL logs. 105 | * 106 | * @param string $message 107 | * @param array $context 108 | * 109 | * @return void 110 | */ 111 | public function info($message, array $context = array()) 112 | { 113 | $this->log(LogLevel::INFO, $message, $context); 114 | } 115 | 116 | /** 117 | * Detailed debug information. 118 | * 119 | * @param string $message 120 | * @param array $context 121 | * 122 | * @return void 123 | */ 124 | public function debug($message, array $context = array()) 125 | { 126 | $this->log(LogLevel::DEBUG, $message, $context); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/Psr/Log/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/Psr/Log/LoggerInterface.php: -------------------------------------------------------------------------------- 1 | logger) { }` 11 | * blocks. 12 | */ 13 | class NullLogger extends AbstractLogger 14 | { 15 | /** 16 | * Logs with an arbitrary level. 17 | * 18 | * @param mixed $level 19 | * @param string $message 20 | * @param array $context 21 | * 22 | * @return void 23 | * 24 | * @throws \Psr\Log\InvalidArgumentException 25 | */ 26 | public function log($level, $message, array $context = array()) 27 | { 28 | // noop 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/README.md: -------------------------------------------------------------------------------- 1 | PSR Log 2 | ======= 3 | 4 | This repository holds all interfaces/classes/traits related to 5 | [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). 6 | 7 | Note that this is not a logger of its own. It is merely an interface that 8 | describes a logger. See the specification for more details. 9 | 10 | Installation 11 | ------------ 12 | 13 | ```bash 14 | composer require psr/log 15 | ``` 16 | 17 | Usage 18 | ----- 19 | 20 | If you need a logger, you can use the interface like this: 21 | 22 | ```php 23 | logger = $logger; 34 | } 35 | 36 | public function doSomething() 37 | { 38 | if ($this->logger) { 39 | $this->logger->info('Doing work'); 40 | } 41 | 42 | // do something useful 43 | } 44 | } 45 | ``` 46 | 47 | You can then pick one of the implementations of the interface to get a logger. 48 | 49 | If you want to implement the interface, you can require this package and 50 | implement `Psr\Log\LoggerInterface` in your code. Please read the 51 | [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 52 | for details. 53 | -------------------------------------------------------------------------------- /integration/testdata/vendored_composer_app/vendor/psr/log/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/log", 3 | "description": "Common interface for logging libraries", 4 | "keywords": ["psr", "psr-3", "log"], 5 | "homepage": "https://github.com/php-fig/log", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "PHP-FIG", 10 | "homepage": "http://www.php-fig.org/" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Log\\": "Psr/Log/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.1.x-dev" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /package.toml: -------------------------------------------------------------------------------- 1 | 2 | [buildpack] 3 | uri = "build/buildpack.tgz" 4 | 5 | [[dependencies]] 6 | uri = "urn:cnb:registry:paketo-buildpacks/httpd@0.7.37" 7 | 8 | [[dependencies]] 9 | uri = "urn:cnb:registry:paketo-buildpacks/nginx@0.17.15" 10 | 11 | [[dependencies]] 12 | uri = "urn:cnb:registry:paketo-buildpacks/composer@0.7.15" 13 | 14 | [[dependencies]] 15 | uri = "urn:cnb:registry:paketo-buildpacks/composer-install@0.3.28" 16 | 17 | [[dependencies]] 18 | uri = "urn:cnb:registry:paketo-buildpacks/php-dist@2.3.25" 19 | 20 | [[dependencies]] 21 | uri = "urn:cnb:registry:paketo-buildpacks/php-httpd@0.3.41" 22 | 23 | [[dependencies]] 24 | uri = "urn:cnb:registry:paketo-buildpacks/php-nginx@0.3.27" 25 | 26 | [[dependencies]] 27 | uri = "urn:cnb:registry:paketo-buildpacks/php-builtin-server@0.4.39" 28 | 29 | [[dependencies]] 30 | uri = "urn:cnb:registry:paketo-buildpacks/php-fpm@0.2.43" 31 | 32 | [[dependencies]] 33 | uri = "urn:cnb:registry:paketo-buildpacks/php-start@0.4.43" 34 | 35 | [[dependencies]] 36 | uri = "urn:cnb:registry:paketo-buildpacks/php-redis-session-handler@0.2.41" 37 | 38 | [[dependencies]] 39 | uri = "urn:cnb:registry:paketo-buildpacks/php-memcached-session-handler@0.2.32" 40 | 41 | [[dependencies]] 42 | uri = "urn:cnb:registry:paketo-buildpacks/procfile@5.10.1" 43 | 44 | [[dependencies]] 45 | uri = "urn:cnb:registry:paketo-buildpacks/environment-variables@4.7.3" 46 | 47 | [[dependencies]] 48 | uri = "urn:cnb:registry:paketo-buildpacks/image-labels@4.7.3" 49 | 50 | [[dependencies]] 51 | uri = "urn:cnb:registry:paketo-buildpacks/ca-certificates@3.8.6" 52 | 53 | [[dependencies]] 54 | uri = "urn:cnb:registry:paketo-buildpacks/watchexec@3.3.1" 55 | -------------------------------------------------------------------------------- /rfcs/0001-restructure.md: -------------------------------------------------------------------------------- 1 | This page has moved. The new location is: 2 | https://github.com/paketo-buildpacks/rfcs/blob/main/text/php/0001-restructure.md 3 | -------------------------------------------------------------------------------- /scripts/.util/builders.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | # shellcheck source=SCRIPTDIR/print.sh 7 | source "$(dirname "${BASH_SOURCE[0]}")/print.sh" 8 | 9 | function util::builders::list() { 10 | local integrationJSON="${1}" 11 | local builders="" 12 | if [[ -f "${integrationJSON}" ]]; then 13 | builders="$(jq --compact-output 'select(.builder != null) | [.builder]' "${integrationJSON}")" 14 | 15 | if [[ -z "${builders}" ]]; then 16 | builders="$(jq --compact-output 'select(.builders != null) | .builders' "${integrationJSON}")" 17 | fi 18 | fi 19 | 20 | if [[ -z "${builders}" ]]; then 21 | util::print::info "No builders specified. Falling back to default builder..." 22 | builders="$(jq --compact-output --null-input '["index.docker.io/paketobuildpacks/builder-jammy-buildpackless-base:latest"]')" 23 | fi 24 | 25 | echo "${builders}" 26 | } 27 | -------------------------------------------------------------------------------- /scripts/.util/print.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | function util::print::title() { 7 | local blue reset message 8 | blue="\033[0;34m" 9 | reset="\033[0;39m" 10 | message="${1}" 11 | 12 | echo -e "\n${blue}${message}${reset}" >&2 13 | } 14 | 15 | function util::print::info() { 16 | local message 17 | message="${1}" 18 | 19 | echo -e "${message}" >&2 20 | } 21 | 22 | function util::print::error() { 23 | local message red reset 24 | message="${1}" 25 | red="\033[0;31m" 26 | reset="\033[0;39m" 27 | 28 | echo -e "${red}${message}${reset}" >&2 29 | exit 1 30 | } 31 | 32 | function util::print::success() { 33 | local message green reset 34 | message="${1}" 35 | green="\033[0;32m" 36 | reset="\033[0;39m" 37 | 38 | echo -e "${green}${message}${reset}" >&2 39 | exitcode="${2:-0}" 40 | exit "${exitcode}" 41 | } 42 | 43 | function util::print::warn() { 44 | local message yellow reset 45 | message="${1}" 46 | yellow="\033[0;33m" 47 | reset="\033[0;39m" 48 | 49 | echo -e "${yellow}${message}${reset}" >&2 50 | exit 0 51 | } 52 | -------------------------------------------------------------------------------- /scripts/.util/tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "jam": "v2.10.1", 3 | "pack": "v0.35.1" 4 | } 5 | -------------------------------------------------------------------------------- /scripts/package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -u 5 | set -o pipefail 6 | 7 | readonly ROOT_DIR="$(cd "$(dirname "${0}")/.." && pwd)" 8 | readonly BIN_DIR="${ROOT_DIR}/.bin" 9 | readonly BUILD_DIR="${ROOT_DIR}/build" 10 | 11 | # shellcheck source=SCRIPTDIR/.util/tools.sh 12 | source "${ROOT_DIR}/scripts/.util/tools.sh" 13 | 14 | # shellcheck source=SCRIPTDIR/.util/print.sh 15 | source "${ROOT_DIR}/scripts/.util/print.sh" 16 | 17 | function main { 18 | local version output token flags 19 | token="" 20 | 21 | while [[ "${#}" != 0 ]]; do 22 | case "${1}" in 23 | --version|-v) 24 | version="${2}" 25 | shift 2 26 | ;; 27 | 28 | --output|-o) 29 | output="${2}" 30 | shift 2 31 | ;; 32 | 33 | --token|-t) 34 | token="${2}" 35 | shift 2 36 | ;; 37 | 38 | --label) 39 | flags+=("--label" "${2}") 40 | shift 2 41 | ;; 42 | 43 | --help|-h) 44 | shift 1 45 | usage 46 | exit 0 47 | ;; 48 | 49 | "") 50 | # skip if the argument is empty 51 | shift 1 52 | ;; 53 | 54 | *) 55 | util::print::error "unknown argument \"${1}\"" 56 | esac 57 | done 58 | 59 | if [[ -z "${version:-}" ]]; then 60 | usage 61 | echo 62 | util::print::error "--version is required" 63 | fi 64 | 65 | if [[ -z "${output:-}" ]]; then 66 | output="${BUILD_DIR}/buildpackage.cnb" 67 | fi 68 | 69 | repo::prepare 70 | 71 | tools::install "${token}" 72 | 73 | buildpack::archive "${version}" 74 | buildpackage::create "${output}" "${flags[@]}" 75 | } 76 | 77 | function usage() { 78 | cat <<-USAGE 79 | package.sh --version [OPTIONS] 80 | 81 | Packages the buildpack into a buildpackage .cnb file. 82 | 83 | OPTIONS 84 | --help -h prints the command usage 85 | --version -v specifies the version number to use when packaging the buildpack 86 | --output -o location to output the packaged buildpackage artifact (default: ${ROOT_DIR}/build/buildpackage.cnb) 87 | --token Token used to download assets from GitHub (e.g. jam, pack, etc) (optional) 88 | USAGE 89 | } 90 | 91 | function repo::prepare() { 92 | util::print::title "Preparing repo..." 93 | 94 | rm -rf "${BUILD_DIR}" 95 | 96 | mkdir -p "${BIN_DIR}" 97 | mkdir -p "${BUILD_DIR}" 98 | 99 | export PATH="${BIN_DIR}:${PATH}" 100 | } 101 | 102 | function tools::install() { 103 | local token 104 | token="${1}" 105 | 106 | util::tools::jam::install \ 107 | --directory "${BIN_DIR}" \ 108 | --token "${token}" 109 | 110 | util::tools::pack::install \ 111 | --directory "${BIN_DIR}" \ 112 | --token "${token}" 113 | } 114 | 115 | function buildpack::archive() { 116 | local version 117 | version="${1}" 118 | 119 | util::print::title "Packaging buildpack into ${BUILD_DIR}/buildpack.tgz..." 120 | 121 | jam pack \ 122 | --buildpack "${ROOT_DIR}/buildpack.toml" \ 123 | --version "${version}" \ 124 | --offline \ 125 | --output "${BUILD_DIR}/buildpack.tgz" 126 | } 127 | 128 | function buildpackage::create() { 129 | local output flags 130 | output="${1}" 131 | flags=("${@:2}") 132 | 133 | util::print::title "Packaging buildpack..." 134 | 135 | args=( 136 | --config "${ROOT_DIR}/package.toml" 137 | --format file 138 | ) 139 | 140 | 141 | args+=("${flags[@]}") 142 | 143 | pack \ 144 | buildpack package "${output}" \ 145 | "${args[@]}" 146 | } 147 | 148 | main "${@:-}" 149 | --------------------------------------------------------------------------------