Weave 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

Proteus Laravel Package

stillat/proteus

Proteus parses, updates, and writes Laravel-style PHP configuration files. Its ConfigWriter facade simplifies changing nested or multiple values, previewing output, guarding entries, and optionally rewriting function calls.

View on GitHub
Deep Wiki
Context7

A library to read, modify, and write Laravel-style PHP configuration files.

Frequently asked questions about Proteus
Is **Proteus** fully compatible with Laravel 13, or will it break my existing configs?
Proteus is **officially validated for Laravel 13** with no breaking changes in v4.2.1. It supports Laravel 13’s improved config system, including new bootstrapping and caching features. Always test in a staging environment if upgrading from older Laravel versions.
Can I use Proteus to dynamically update configs in production without downtime?
Yes, Proteus allows **runtime config updates** (e.g., feature flags, environment overrides) without restarting the app. Use `write()` or `writeMany()` methods, but ensure proper **file permissions** and **caching** (e.g., `config:cache`) are disabled or flushed post-update.
How do I prevent accidental changes to critical config keys like `app.key` or `database.*`?
Use `ConfigWriter::guard()` to lock specific keys (e.g., `ConfigWriter::guard('app.key')`) or entire namespaces (e.g., `ConfigWriter::guard('database.*')`). Attempted mutations trigger a `GuardedConfigurationMutationException`, halting execution.
Does Proteus support **database-backed configs** (e.g., storing configs in MySQL/PostgreSQL)?
Proteus works with **any storage backend**—you can serialize configs to JSON/DB via Eloquent or Doctrine. For Laravel 13, leverage its improved Eloquent features (e.g., query caching) to optimize performance when reading/writing configs from the database.
What’s the difference between `preview()` and `write()` in Proteus? How do I test changes safely?
`preview()` returns a **temporary config document** without saving to disk, while `write()` persists changes. Use `preview()` in tests or CI to validate changes before committing. For Laravel 13, integrate with **Pest 2.0** to mock `ConfigWriter` and test dynamic updates.
Will Proteus rewrite `env()` calls in my config files automatically? How do I control this?
By default, Proteus **preserves** `env()` calls. Enable rewrites with `ConfigWriter::ignoreFunctionCalls(false)` to replace them with static values. This is useful for **hardcoding env vars** in configs but may require adjustments if your app relies on runtime env resolution.
Is Proteus slower than Laravel’s native `config()` helper? Should I avoid it for performance-critical apps?
Proteus adds **minimal overhead** compared to Laravel’s native config system. For heavy configs, benchmark against `file_get_contents()` or Laravel 13’s **optimized bootstrapping**. If performance is critical, cache configs with `config:cache` and use Proteus only for dynamic updates.
Can I use Proteus in a **non-Laravel PHP project** (e.g., Symfony, standalone scripts)?
Proteus is **PHP 8.1+ compatible** and can work outside Laravel, but it’s **optimized for Laravel’s `ConfigRepository`**. Non-Laravel apps may need extra setup (e.g., manual config file loading). For pure PHP, consider `vlucas/phpdotenv` for env-based configs.
How do I migrate from Laravel’s native config system to Proteus without breaking existing code?
Replace `config('key')` with `ConfigWriter::get('key')` for reads. For writes, use `ConfigWriter::write()` instead of manual file edits. Laravel 13’s **improved config caching** (`config:clear`, `config:cache`) works seamlessly with Proteus—just ensure your `config/cache.php` is updated.
What are the best alternatives to Proteus for Laravel config management?
For **Laravel-specific** needs, compare with `spatie/laravel-config-array` (simpler array-based configs) or Laravel 13’s **native tools** (`config:clear`, `config:cache`). For **env-focused** configs, `vlucas/phpdotenv` is lighter. Proteus excels in **dynamic, validated, and guarded** configs—ideal for microservices or feature-flag-heavy apps.
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.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums