Search by

code-pulse / laravel

solutionbowl

Send this Laravel application's source to Code Pulse for analysis. No Git credentials — just a key from your Code Pulse portal.

v1.0.0 2026-11-30 10:47 UTC

This package is auto-updated.

Last update: 2026-11-30 11:19:20 UTC


README

This repository is a read-only split of solutionbowl-git/codepulse-extensions, published for Composer. Open issues and pull requests on the main repository.

A Composer package that sends your application's source to Code Pulse for analysis. No GitHub, Bitbucket or Azure credential is involved — you put one key in .env and run an artisan command.

Requires PHP 8.1+ and Laravel 9, 10, 11 or 12.

Install

composer require code-pulse/laravel
php artisan vendor:publish --tag=codepulse-config

The service provider is auto-discovered, so there is nothing to register.

Not published yet. Until the package name is registered, install it from a checkout by adding a path repository to your application's composer.json:

{
  "repositories": [
    { "type": "path", "url": "../codepulse-platform/extensions/laravel" }
  ]
}

then composer require code-pulse/laravel:*.

Where the key goes

In your .env:

CODEPULSE_KEY=cp_ext_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Create the key in your Code Pulse portal under Extensions. It is shown exactly once; Code Pulse stores only a hash of it. If you lose it, create a new one and revoke the old.

.env is already gitignored in a stock Laravel application — keep it that way. The package reads the key through config('codepulse.key'), never prints it, never logs it, and scrubs anything key-shaped out of its own error messages. There is deliberately no --key option: a key on the command line lands in your shell history and in the process list.

.env is also never uploaded — see below.

Use

php artisan codepulse:activate              # check the key and what the account can do
php artisan codepulse:scan --dry-run        # list what would be uploaded; sends nothing
php artisan codepulse:scan                  # activate, collect, upload, wait, report
php artisan codepulse:scan --status=42      # fetch the findings of an earlier scan

Options for codepulse:scan:

Option What it does
--dry-run list what would be uploaded and send nothing (needs no key and no network)
--truncate if the project exceeds the scan limits, upload as much as fits
--no-wait upload and exit; fetch the findings later with --status=
--status=<id> skip the scan and print an earlier scan's findings
--fail-on=<sev> exit non-zero if any finding is critical/high/medium/low or worse
--json print the raw result as JSON

In CI:

- run: php artisan codepulse:scan --fail-on=high
  env:
    CODEPULSE_KEY: ${{ secrets.CODEPULSE_KEY }}

Configuration

config/codepulse.php after publishing:

Key Default What
key env('CODEPULSE_KEY') the extension key
url https://project-estimate.code-pulse.ai the Code Pulse host
project env('APP_NAME') how this app appears in Code Pulse
paths app, bootstrap/app.php, config, database, routes, resources, tests, artisan, composer.json, package.json what to scan, relative to base_path()
exclude [] extra gitignore-syntax patterns
use_gitignore true honour the project's own .gitignore
on_limit fail fail or truncate when the project is over a scan's limits
timeout 180 HTTP timeout for the upload, in seconds

storage, public and vendor are left out of the default paths because they are generated, user-supplied or third-party. Set paths to ['.'] to offer the whole project — the deny rules below still apply.

What gets uploaded

Text source files from the configured paths. Run php artisan codepulse:scan --dry-run to see the exact list before anything is sent.

Never uploaded, and not overridable from config:

  • .env and every .env.* (including .env.example) — your database password, APP_KEY, and every other secret
  • storage/oauth-private.key and oauth-public.key — Passport's signing keys
  • dependency directories — vendor, node_modules, bower_components
  • version control — .git, .hg, .svn
  • build output and caches — dist, build, public/build, storage/framework, coverage, .cache
  • lockfiles — composer.lock, package-lock.json, yarn.lock, …
  • anything else that could hold a credential — *.pem, *.key, *.p12, *.pfx, *.jks, id_rsa*, .npmrc, .netrc, *credentials*, service-account*.json, secrets.*
  • anything that is not text source — images, fonts, archives, binaries, any file with a NUL byte
  • any file larger than ~200 KB
  • symlinks are never followed
  • anything your .gitignore excludes (plus .codepulseignore, same syntax), and anything your exclude patterns match

Also redacted inside the files that do go up. Before upload, every file is scanned for credential-shaped strings, replaced with [REDACTED:<kind>]: a real base64:-prefixed APP_KEY, private key blocks, AWS access key ids, GitHub / Slack / Stripe / Razorpay / Google / OpenAI tokens, JWTs, Bearer tokens, user:password@host in connection URLs, define('DB_PASSWORD', '...') and 'password' => '...'-style assignments. env('DB_PASSWORD') with no inline value is left alone, as are placeholders such as changeme and your-api-key, so config/*.php still reads normally. The command prints a count of what it redacted.

What leaves your machine: those file paths and contents, your project name, and the package version. Nothing else — no environment variables, no database, no storage, no logs.

Limits

One scan carries at most 2000 files and 20 MB of source, and a key may make 30 requests a minute. These are enforced before anything is uploaded, so an oversized project gets a message naming your largest directories rather than a rejected upload. Narrow paths or exclude, or run with --truncate to send what fits.

Reading the output

CRITICAL app/Http/Controllers/UserController.php:42
  SQL injection in search()
  The query interpolates $request->input('q') directly.
  -> Use a query builder binding or a prepared statement
  [security]

3 findings in 184 files: 1 critical, 1 medium, 1 low

--json gives you the raw {status, file_count, findings[]} payload instead.

Tests

php extensions/laravel/tests/standalone.php   # no Composer, no PHPUnit, no Laravel needed
composer test                                  # the same tests under PHPUnit

37 tests covering file collection, ignore rules, .gitignore semantics, the deny policy (including .env and Passport keys), limit enforcement, truncation and redaction. They are ordinary PHPUnit test cases; tests/standalone.php supplies a minimal TestCase so the logic that decides what leaves a customer's machine can be verified with nothing but PHP.

The HTTP client is not covered by these tests — it needs Laravel's Http facade. Exercise it with php artisan codepulse:activate against a real key.