Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Plugin Laravel Laravel Package

psalm/plugin-laravel

Psalm plugin for Laravel that adds deep framework-aware static analysis plus taint-based security scanning. Detects SQL injection, XSS, SSRF, shell injection, file traversal, and open redirects by tracking user input flows across functions and services.

View on GitHub
Deep Wiki
Context7

title: NoEnvOutsideConfig parent: Custom Issues nav_order: 1

NoEnvOutsideConfig

Emitted when env() is called outside the config/ directory.

Why this is a problem

When you run php artisan config:cache, Laravel loads all config files once and caches the result. After that, the .env file is not loaded — so any env() call outside config/ returns null.

This is a documented Laravel behavior:

You should be confident that you are only calling the env function from within your configuration files. [...] If you cache your configuration, the env function will only return null.

Examples

// Bad — will return null when config is cached
class PaymentService
{
    public function getKey(): string
    {
        return env('STRIPE_SECRET'); // NoEnvOutsideConfig
    }
}
// Good — read env in config, use config() elsewhere

// config/services.php
return [
    'stripe' => [
        'secret' => env('STRIPE_SECRET'),
    ],
];

// app/Services/PaymentService.php
class PaymentService
{
    public function getKey(): string
    {
        return config('services.stripe.secret');
    }
}

How to fix

  1. Move the env() call into a config file (e.g. config/services.php)
  2. Reference the value via config() in your application code
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport