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

Configcat Client Laravel Package

configcat/configcat-client

ConfigCat PHP SDK client for feature flags and remote configuration. Fetch typed setting values from ConfigCat using your SDK key, with targeting by user attributes (region, email, custom). Supports PHP 8.1+ and integrates via Composer.

View on GitHub
Deep Wiki
Context7
v9.2.1

Changed

  • Release for #57
v9.2.0

Removed

  • Support for Guzzle v6 due to switching to PSR-18 ClientInterface, which is only supported in Guzzle v7. #49
v9.1.1

Added

  • In-memory cache layer to custom cache implementations.
  • Coverage report upload to SonarCloud.
v9.1.0

New features and improvements:

  • When an error occurs and there is a related Throwable object, pass it to the onError hook handlers. (#46)
  • When forceRefresh fails and there is a related Throwable object, expose it in RefreshResult via the new getErrorException property.
  • Handle unexpected errors in the forceRefresh method (to stop potential unhandled exceptions thrown by the evaluation logic from bringing down the consumer's application).

Breaking changes:

  • Rename the getError property to getErrorMessage in RefreshResult. (Low impact expected.)
  • Add an extra parameter of type ?Throwable to the onError hook handlers. (Low impact expected.)
  • Don't include event_id in the log message but leave it up to the actual logger implementation to choose the log message format. (Affects consumers using custom logging only.)
v9.0.0

New features and improvements:

  • Add support for the new Config JSON v6 format: update the config model and implement new features in setting evaluation logic. (#44)
  • Overhaul setting evaluation-related logging and make it consistent across SDKs.
  • Improve consistency of config JSON deserialization error reporting.
  • Add exception message and stack trace to the log format of the default logger.
  • When evaluation fails and there is a related Throwable object, expose it in EvaluationDetails via the new getErrorException property.
  • Performance improvements to setting evaluation (building of evaluation log is expensive, so it is skipped when info level logging is turned off).

Bug fixes:

  • Fix inconsistent logging of error 1000 in the case of flag overrides.

Breaking changes (listed in the order of expected impact):

  • Rename the getError property to getErrorMessage in EvaluationDetails.
  • Rename the getMatchedEvaluationRule property to getMatchedTargetingRule and the getMatchedEvaluationPercentageRule property to getMatchedPercentageOption in EvaluationDetails.
  • Move config JSON attribute descriptor classes from the ConfigCat\Attributes to the ConfigCat\ConfigJson namespace and update them to support config JSON schema v6.
v8.1.0

Added

  • Ability to override the default Guzzle HTTP client with a custom one:

    • The user has to implement the \ConfigCat\Http\FetchClientInterface to give the SDK a custom \Psr\Http\Client\ClientInterface implementation.
      namespace ConfigCat\Http;
      
      interface FetchClientInterface
      {
          public function getClient(): \Psr\Http\Client\ClientInterface;
          public function createRequest(string $method, string $uri): \Psr\Http\Message\RequestInterface;
      }
      
    • There's a new \ConfigCat\ClientOptions::FETCH_CLIENT configuration option where the SDK accepts a custom \ConfigCat\Http\FetchClientInterface implementation. This option defaults to \ConfigCat\Http\GuzzleFetchClient.
    • The Guzzle specific \ConfigCat\ClientOptions::REQUEST_OPTIONS and \ConfigCat\ClientOptions::CUSTOM_HANDLER configuration options have been marked as deprecated. Options for Guzzle are available through the \ConfigCat\Http\GuzzleFetchClient::create() method:
      $client = new \ConfigCat\ConfigCatClient('<SDK-KEY>', [
           \ConfigCat\ClientOptions::FETCH_CLIENT => \ConfigCat\Http\GuzzleFetchClient::create([
               \GuzzleHttp\RequestOptions::CONNECT_TIMEOUT => 5,
           ]),
       ]);
      
    • The direct dependency to guzzlehttp/guzzle was not removed yet due to minor upgrade backward compatibility. It can be moved to suggest at the next major version bump.
  • php-cs-fixer linter and phpstan static analyzer to the CI workflow. The whole project was reformatted and analyzed, this is why this PR is bigger than usual.

Removed

  • Dependency to Monolog. It was replaced by a simple default logger that writes to error_log(). It's still replaceable with any psr/log implementation.
v8.0.0

Changed

  • Standardized config cache key generation algorithm and cache payload format to allow shared caches to be used by SDKs of different platforms.
  • getFetchTimeUnixSeconds() getter of EvaluationDetails was renamed to getFetchTimeUnixMilliseconds() and now returns the fetch time in float Unix milliseconds.

Removed

  • getVariationId() / getAllVariationIds() methods. Alternative: getValueDetails() / getAllValueDetails()
v7.1.1

Fixed

  • Wrong return value of getValueDetails() if a non-existent flag was requested.
v7.1.0

Fixed

  • The URL passed via the BASE-URL option was always overridden by the CDN URL from the downloaded config.json.
v7.0.1
  • Fixed monolog dependency version for #29
  • Fixed reported SDK version in X-ConfigCat-UserAgent HTTP header.
v7.0.0
  • Changed the minimum required PHP version to 8.1. Support for PHP 7 is still maintained here.
  • Deprecated getVariationId() and getAllVariationIds() methods in favor of getValueDetails() and getAllValueDetails().
v6.2.1

Fixed

  • LogLevel::NO_LOG cannot be used (#27)
v6.2.0

Added

  • setDefaultUser(user) / clearDefaultUser() methods to set / remove a default user object used when there's no user passed to getValue() / getValueDetails() / getAllValues() / getAllVariationIds() methods.
  • setOffline() / setOnline() methods to indicate whether the SDK is allowed to make HTTP calls or not. In 'offline' mode the SDK works from the cache only.
  • onConfigChanged([String => Setting]) / onFlagEvaluated(EvaluationDetails) / onError(String) hooks. Subscription is possible on the hooks() property of ConfigCatClient.
  • getValueDetails() method to retrieve evaluation details along with the feature flag / setting value. It returns the same details that is passed to onFlagEvaluated(EvaluationDetails) on each evaluation.
  • forceRefresh() method returns with a result object to indicate whether the refresh succeeded or not.

Changed

  • ArrayCache has a global static array now that caches the entries between each ConfigCatClient instance. The only differentiator is the sdkKey, so each client instance with the same sdkKey will use the same cache entry.
v6.1.0
  • Contents of #22 (Improve testability of implementations using ConfigCatClient as a dependency)
v6.0.0

Changed

  • Increased the minimum required PHP version to 7.1

Breaking changes

  • Added the appropriate type hints to publicly available methods:
     // Cache:
     abstract protected function get(string $key); -> abstract protected function get(string $key): ?string;
     abstract protected function get(string $key); -> abstract protected function set(string $key, string $value): void;
    
     // ConfigCatClient:
     function getValue($key, $defaultValue, User $user = null) -> function getValue(string $key, $defaultValue, User $user = null)
     function getVariationId($key, $defaultVariationId, User $user = null) -> function getVariationId(string $key, $defaultVariationId, User $user = null)
     function getAllVariationIds(User $user = null) -> function getAllVariationIds(User $user = null): array
     function getKeyAndValue($variationId) -> function getKeyAndValue(string $variationId): ?Pair
     function getAllKeys() -> function getAllKeys(): array
     function getAllValues(User $user = null) -> function getAllValues(User $user = null): array
     function forceRefresh() -> function forceRefresh(): void
    
v5.4.1
  • Fix unserialize deprecation error. #19
v5.4.0

Fixed

  • The evaluation logs are staying on info level but they are now combined into a single log entry.
  • Set the default log level to WARNING.

Added

  • An additional NO_LOG log level was added to turn off the logging.
  • New flag-overrides configuration option was added to support the reading of flags & settings from a local file or an associative array.
  • New getAllValues() function was added for evaluating all available flags.
v5.3.1

Update comments related to additional configuration options.

v5.3.0

Fix wrong request option parameter handling for guzzle: connect-timeout ➡️ connect_timeout.

v5.2.1

Fixed wrong error message reported when the config.json download failed and simultaneously the cache was also empty. #13

v5.2.0

Added two extra client configuration options for logging:

Name Type Example Description
log-level int 'log-level' => \ConfigCat\Log\LogLevel::DEBUG Sets the logging severity for the ConfigCat SDK. It must be a value from the constants of the \ConfigCat\Log\LogLevel class.
exceptions-to-ignore array 'exceptions-to-ignore' => [InvalidOperationException::class] A list of exception class types that should be excluded from logging.
v5.1.0

Add support for Guzzle v7 #9

v5.0.0

Addressing global data handling and processing trends via Data Governance feature. Customers can control the geographic location where their config JSONs get published to. See the docs. We are introducing a new DataGovernance initialization parameter. Set this parameter to be in sync with the Data Governance preference on the Dashboard. Breaking change:

  • Custom cache implementations should implement the new cache interface using key parameter in the get/set methods.
v4.1.0

Added variation id related functions to support integration with analytical tools:

  • getVariationId()
  • getAllVariationIds()
  • getKeyAndValue()
v4.0.1

Fix warning reported in #6

v4.0.0

Breaking change: Renamed API Key to SDK Key.

v3.0.3

Add ^2.0 monolog dependency

v3.0.2

Moving from config_v3.json to config_v4.json.

v3.0.1

Supporting sensitive comparators in targeting rules.

v2.0.3

Logging fix

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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity