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
Cloud Secret Manager

Cloud Secret Manager Laravel Package

google/cloud-secret-manager

Idiomatic PHP client for Google Cloud Secret Manager. Manage secrets and versions, access payloads, and integrate securely with GCP apps. Supports REST and gRPC transports, with official API docs and auth guides via Google Cloud PHP.

View on GitHub
Deep Wiki
Context7

google/cloud-secret-manager is an idiomatic PHP client for Google Cloud Secret Manager, enabling secure storage and retrieval of application secrets via a clean, strongly-typed API. It’s part of the Google Cloud PHP ecosystem and supports both REST (HTTP/1.1) and gRPC transports for flexible deployment and performance needs.

Use it to fetch, manage, and automate secret access in your PHP services with standard Google Cloud authentication and official API references.

  • GA stability with predictable, backwards-compatible releases
  • Supports REST and gRPC (including streaming where available)
  • First-class request/response message objects and generated clients
  • Built-in error handling via ApiException
  • Links to official docs, auth, and debugging guides
Frequently asked questions about Cloud Secret Manager
How do I integrate Google Cloud Secret Manager with Laravel’s config system?
Use Laravel’s `AppServiceProvider` to bootstrap the `SecretManagerServiceClient` during the `booted` event. Fetch secrets dynamically (e.g., `config('services.database.password')`) and cache them in Redis/Memcached to reduce API calls. The package’s REST/gRPC endpoints align with Laravel’s runtime needs.
What Laravel versions does this package support?
The package is framework-agnostic but works seamlessly with Laravel 8.x–11.x. Ensure your PHP version (8.1+) matches Laravel’s requirements. No Laravel-specific dependencies exist, so it integrates via service providers or Artisan commands.
Can I use this for multi-environment Laravel deployments (dev/staging/prod)?
Yes. Leverage GCP’s secret versioning and tags to map to Laravel’s `.env` files. For example, use `secret-version:prod` for production and inject the correct version via environment variables or Laravel’s `config()` system during deployment.
How do I handle authentication for Laravel apps running on Cloud Run or GKE?
Use GCP Workload Identity to delegate IAM roles to your Laravel service account. For Cloud Run, set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the service account key. The package’s `SecretManagerServiceClient` will auto-detect credentials from metadata or the env var.
What’s the performance impact of gRPC vs. REST for Laravel?
gRPC reduces latency for high-frequency calls (e.g., API gateways) but requires additional setup. For most Laravel apps, REST is sufficient. Cache secrets in Redis with TTL-based invalidation to minimize API calls. Benchmark your use case—GCP’s global endpoints help mitigate latency.
How do I rotate secrets automatically in Laravel?
Use Laravel’s `Artisan::schedule()` to trigger secret rotations via GCP’s Cloud Scheduler or Pub/Sub. For example, schedule a command to update `config('services.api_key')` by calling `secretManagerServiceClient->addSecretVersion()`. Combine with GCP’s rotation policies for compliance.
Is there a Laravel-specific exception handler for Google’s ApiException?
No, but you can wrap `ApiException` in a custom Laravel exception handler (e.g., `GoogleSecretManagerException`). Log errors to Sentry/Monolog and surface user-friendly messages. Example: `throw new GoogleSecretManagerException($ex->getMessage(), $ex->getCode());`
Can I use this package for non-GCP Laravel deployments?
The package is GCP-native, but you can abstract it behind a `SecretManagerInterface` to swap providers later (e.g., AWS Secrets Manager). Start with GCP’s IAM and audit features, then refactor if migrating to multi-cloud. Document the abstraction layer for future flexibility.
How do I debug issues with secret fetching in Laravel?
Enable GCP’s debug logging via `GOOGLE_CLOUD_DEBUG=secretmanager` environment variable. Use Laravel’s `Log::debug()` to trace secret retrieval paths. Check GCP’s audit logs for API call failures. The package’s `ApiException` includes detailed error codes for troubleshooting.
What are the cost implications of using Secret Manager in Laravel?
GCP charges per API call and secret version. Cache secrets aggressively (Redis) and clean up old versions to control costs. Set budget alerts in GCP and monitor usage via Cloud Monitoring. For high-throughput apps, gRPC reduces costs compared to REST.
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