Skip to content

chore: rename API_KEY env var to SERPAPI_KEY - #4

Open
galetahub wants to merge 1 commit into
masterfrom
rename-env-serpapi-key
Open

chore: rename API_KEY env var to SERPAPI_KEY#4
galetahub wants to merge 1 commit into
masterfrom
rename-env-serpapi-key

Conversation

@galetahub

Copy link
Copy Markdown
Contributor

Summary

Renames the environment variable used for the SerpApi secret key from API_KEY to SERPAPI_KEY, aligning this library with serpapi-ruby, which uses ENV['SERPAPI_KEY'].

The generic API_KEY name is ambiguous in projects that integrate multiple APIs; SERPAPI_KEY is explicit and consistent across our client libraries.

Changes

  • tests/SerpApiTestCase.php — resolves the key from SERPAPI_KEY ($_ENV and getenv), skip message updated
  • .github/workflows/serpapi-php.ymlSERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
  • README.md.erb + regenerated README.md — all examples use getenv('SERPAPI_KEY') and export SERPAPI_KEY=...

Client itself is unchanged: the key is still passed explicitly to the constructor or via setApiKey(), matching serpapi-ruby's behavior. No auto-reading of the environment was added.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates this PHP client library’s developer/test/documentation surfaces to use a less ambiguous environment variable name (SERPAPI_KEY) for the SerpApi secret key, aligning with naming used in other SerpApi client libraries.

Changes:

  • Update test key resolution and skip messaging to read SERPAPI_KEY (via $_ENV and getenv).
  • Update GitHub Actions workflow to pass SERPAPI_KEY from repository secrets.
  • Update README template and generated README examples to reference SERPAPI_KEY.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/SerpApiTestCase.php Resolves API key from SERPAPI_KEY and updates the skip message accordingly.
README.md.erb Updates all generated snippets/examples to use getenv('SERPAPI_KEY') and export instructions.
README.md Regenerated documentation reflecting SERPAPI_KEY usage throughout examples and test setup.
.github/workflows/serpapi-php.yml Renames workflow and updates test job env var to SERPAPI_KEY secret.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@galetahub
galetahub requested review from jvmvik and strzibny August 15, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants