- What is cardtechie/tradingcardapi-sdk-php used for?
- It is a lightweight PHP SDK for integrating the Trading Card API into PHP applications. It provides a framework-agnostic client for searching cards, fetching detailed card lookups, and accessing pricing and market data. It works well with Laravel but does not require it.
- How do I install the Trading Card API PHP SDK in Laravel?
- Install it with Composer using an explicit constraint such as cardtechie/tradingcardapi-sdk-php:^0.3.4. Configure credentials through your Laravel environment, for example TRADINGCARDAPI_API_KEY, and resolve the client through your own service provider or facade binding. The package is a vendor SDK rather than a deeply coupled Laravel package, so expect a small amount of application-side wiring.
- Which Laravel and PHP versions does this SDK support?
- The SDK is documented as compatible with Laravel 9 through 12 and requires PHP ^8.1. That fits standard modern Laravel deployment patterns including environment configuration, config caching, queue workers, and containerized runtimes. Confirm your exact framework and PHP patch versions during upgrade planning because the package is still pre-1.0.
- How do I configure the API key for tradingcardapi-sdk-php?
- Configuration is environment-driven through TRADINGCARDAPI_API_KEY or programmatic through TradingCardApi::withApiKey(). Keep portal-issued keys out of source control and inject them per environment. Treat them as secrets with a rotation and revocation procedure, especially because tc_ keys have read-only scope.
- What is the difference between a tc_ API key and OAuth in this SDK?
- The 0.3.4 release adds an api_key auth mode for portal-issued tc_ keys, which are read-only. Write operations and any Internal calls still require OAuth, so the integration has two credential paths to configure and test. The README also documents a legacy PAT auth mode, meaning real deployments may use OAuth, legacy PAT, or tc_ keys.
- Can I use this Trading Card API SDK without Laravel?
- Yes. The SDK is framework-agnostic and can be used in any PHP application that meets the PHP ^8.1 requirement. Laravel integration is optional and typically involves environment-based configuration plus resolving the client through your container. There are no framework-level bootstrapping requirements implied by the release.
- How do I search cards and fetch card details or pricing with the SDK?
- The client exposes card search, detailed card lookups, and access to pricing and market data through the Trading Card API. You configure credentials once, then call the relevant SDK methods and handle the consistent response format. Check the README for exact endpoint method names and response shapes before building your application logic.
- Is cardtechie/tradingcardapi-sdk-php production ready?
- It is pre-1.0 at version 0.3.4, so minor 0.x releases may introduce breaking changes and patch releases are not contractually guaranteed to be non-breaking like a 1.x package. Pin the dependency and upgrade deliberately. The split tc_ and OAuth auth model also means production applications need explicit call routing and credential handling.
- Why does my tc_ API key fail on some SDK calls?
- Portal-issued tc_ keys are read-only, while write operations and Internal calls still require OAuth. An insufficiently scoped key typically fails at runtime on the first affected API call rather than at configuration time. Route write and Internal paths through OAuth and add capability checks in your application so read-only keys are not used where they cannot work.
- How should I test Laravel code that uses this SDK?
- The release notes and README excerpt do not document dedicated testing helpers or a fake client. The safest approach is to wrap SDK calls in your own application service and substitute a stub implementation in Laravel tests. Before relying on transport-level mocking, confirm whether the SDK accepts a custom HTTP handler or client.