{"id":26514895,"url":"https://github.com/devcyclehq/php-server-sdk","last_synced_at":"2025-03-21T05:29:42.556Z","repository":{"id":37961965,"uuid":"431251468","full_name":"DevCycleHQ/php-server-sdk","owner":"DevCycleHQ","description":"DevCycle - PHP Server SDK","archived":false,"fork":false,"pushed_at":"2024-04-25T16:03:20.000Z","size":206,"stargazers_count":17,"open_issues_count":3,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-25T20:15:50.725Z","etag":null,"topics":["devcycle","feature-flags","feature-toggles","openfeature"],"latest_commit_sha":null,"homepage":"https://docs.devcycle.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevCycleHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-23T20:58:33.000Z","updated_at":"2024-04-25T17:39:20.000Z","dependencies_parsed_at":"2024-02-13T22:29:44.395Z","dependency_job_id":"d708d049-de44-4734-9e08-0f2436ee72ec","html_url":"https://github.com/DevCycleHQ/php-server-sdk","commit_stats":{"total_commits":23,"total_committers":8,"mean_commits":2.875,"dds":0.6086956521739131,"last_synced_commit":"51c3b98a2417f7dd193ef38b8dbefe8ff70ec948"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevCycleHQ%2Fphp-server-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevCycleHQ%2Fphp-server-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevCycleHQ%2Fphp-server-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevCycleHQ%2Fphp-server-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevCycleHQ","download_url":"https://codeload.github.com/DevCycleHQ/php-server-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244745219,"owners_count":20503040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devcycle","feature-flags","feature-toggles","openfeature"],"created_at":"2025-03-21T05:29:41.803Z","updated_at":"2025-03-21T05:29:42.545Z","avatar_url":"https://github.com/DevCycleHQ.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DevCycle PHP Server SDK\n\nWelcome to the DevCycle PHP SDK, initially generated via the [DevCycle Bucketing API](https://docs.devcycle.com/bucketing-api/#tag/devcycle).\n\n## Requirements\n\nPHP 8.0 and later.\n\n## Installation\n\n### Composer Installation\n\nTo install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:\n\n```json\n{\n  \"require\": {\n    \"devcycle/php-server-sdk\": \"*\"\n  }\n}\n```\n\nThen run `composer install`\n\n## Getting Started\n\nPlease follow the [installation procedure](#installation--usage) and then run the following:\n\n```php\n\u003c?php\nrequire_once(__DIR__ . '/vendor/autoload.php');\n\nuse DevCycle\\Api\\DevCycleClient;\nuse DevCycle\\Model\\DevCycleOptions;\nuse DevCycle\\Model\\DevCycleUser;\n\n$options = new DevCycleOptions(\n    false,\n    $bucketingHostname,\n    $unixSocketPath\n);\n\n$devCycleClient = new DevCycleClient(\n    sdkKey: getenv(\"DEVCYCLE_SERVER_SDK_KEY\"),\n    dvcOptions: $options\n);\n\n$user_data = new DevCycleUser(array(\n  \"user_id\"=\u003e\"my-user\"\n));\n\ntry {\n    $result = $apiInstance-\u003eallFeatures($user_data);\n    print_r($result);\n} catch (Exception $e) {\n    echo 'Exception when calling DevCycleClient-\u003eallFeatures: ', $e-\u003egetMessage(), PHP_EOL;\n}\n\n```\n\n\n\n## Usage\n\nTo find usage documentation, visit our [docs](https://docs.devcycle.com/docs/sdk/server-side-sdks/php#usage).\n\n# OpenFeature Support\n\nThis SDK provides an implementation of the [OpenFeature](https://openfeature.dev/) Provider interface. Use the `getOpenFeatureProvider()` method on the DevCycle SDK client to obtain a provider for OpenFeature.\n\n```php\n$devCycleClient = new DevCycleClient(\n    sdkKey: getenv(\"DEVCYCLE_SERVER_SDK_KEY\"),\n    dvcOptions: $options\n);\n$api-\u003esetProvider($devCycleClient-\u003egetOpenFeatureProvider());\n```\n\n- [The DevCycle PHP OpenFeature Provider](https://docs.devcycle.com/sdk/server-side-sdks/php/php-openfeature)\n- [The OpenFeature documentation](https://openfeature.dev/docs/reference/intro)\n\n## Advanced Options (Local Bucketing)\n\nBecause of the nature of PHP - we can't directly support local bucketing within PHP - but we have created a supporting worker that\ncan be used to emulate the local bucketing function of low latency and high throughput.\nThis proxy can be found here: https://github.com/devcyclehq/local-bucketing-proxy\n\nThe proxy has two modes - HTTP, and Unix sockets. The PHP SDK supports both modes, but the HTTP mode should be used for most cases.\n\nThe configuration for this proxy (in HTTP mode) is as follows (replacing the URL with the URL of the proxy):\n\n```\nuse DevCycle\\Model\\DevCycleOptions;\n\n$options = new DevCycleOptions(\n    enableEdgeDB: false, \n    bucketingApiHostname = \"hostname for sdk proxy here\"\n);\n```\n\nThe configuration for this proxy (in Unix socket mode) is as follows (replacing the UDS path with the path to the socket):\n```\nuse DevCycle\\Model\\DevCycleOptions;\n\n$options = new DevCycleOptions(\n    enableEdgeDB: false, \n    bucketingApiHostname: \"http:/localhost\",\n    unixSocketPath: \"/path/to/unix/socket\"\n);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcyclehq%2Fphp-server-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevcyclehq%2Fphp-server-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcyclehq%2Fphp-server-sdk/lists"}