{"id":18936635,"url":"https://github.com/cloudevents/sdk-php","last_synced_at":"2025-04-08T09:06:42.299Z","repository":{"id":43718175,"uuid":"260334291","full_name":"cloudevents/sdk-php","owner":"cloudevents","description":"PHP SDK for CloudEvents","archived":false,"fork":false,"pushed_at":"2025-02-07T18:32:25.000Z","size":97,"stargazers_count":88,"open_issues_count":1,"forks_count":19,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-01T07:49:31.599Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudevents.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2020-04-30T22:46:17.000Z","updated_at":"2025-03-06T22:09:09.000Z","dependencies_parsed_at":"2023-10-16T23:30:53.582Z","dependency_job_id":"65480c54-c2b8-4c5c-8172-2b3a14640008","html_url":"https://github.com/cloudevents/sdk-php","commit_stats":{"total_commits":34,"total_committers":7,"mean_commits":4.857142857142857,"dds":"0.47058823529411764","last_synced_commit":"f2e22c624bd1380e50b6a5c1a9526e29bcce6317"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudevents","download_url":"https://codeload.github.com/cloudevents/sdk-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"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":["hacktoberfest"],"created_at":"2024-11-08T12:08:20.369Z","updated_at":"2025-04-08T09:06:42.265Z","avatar_url":"https://github.com/cloudevents.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP SDK for [CloudEvents](https://github.com/cloudevents/spec)\n\n## Status\n\nThis SDK currently supports the following versions of CloudEvents:\n\n- [v1.0](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md)\n\n## Installation\n\nInstall the SDK using [Composer](https://getcomposer.org/):\n\n```sh\n$ composer require cloudevents/sdk-php\n```\n\n## Create a CloudEvent\n\n```php\nuse CloudEvents\\V1\\CloudEvent;\nuse CloudEvents\\V1\\CloudEventImmutable;\n\n// Immutable CloudEvent\n$immutableEvent = new CloudEventImmutable(\n    '1n6bFxDMHZFChlI4TVI9tdzphB9',\n    '/examples/php-sdk',\n    'com.example.type',\n    ['example' =\u003e 'first-event'],\n    'application/json'\n);\n\n// Mutable CloudEvent\n$mutableEvent = new CloudEvent(\n    '1n6bFxDMHZFChlI4TVI9tdzphB9',\n    '/examples/php-sdk',\n    'com.example.type',\n    ['example' =\u003e 'first-event'],\n    'application/json'\n);\n\n// Create immutable from mutable or via versa\n$event = CloudEventImmutable::createFromInterface($mutableEvent);\n$event = CloudEvent::createFromInterface($immutableEvent);\n```\n\n## Serialize/Deserialize a CloudEvent\n\n```php\nuse CloudEvents\\Serializers\\JsonDeserializer;\nuse CloudEvents\\Serializers\\JsonSerializer;\n\n// JSON serialization\n$payload = JsonSerializer::create()-\u003eserializeStructured($event);\n$payload = JsonSerializer::create()-\u003eserializeBatch($events);\n\n// JSON deserialization\n$event = JsonDeserializer::create()-\u003edeserializeStructured($payload);\n$events = JsonDeserializer::create()-\u003edeserializeBatch($payload);\n```\n\n## Marshal/Unmarshal a CloudEvent\n\n```php\nuse CloudEvents\\Http\\Marshaller;\nuse CloudEvents\\Http\\Unmarshaller;\n\n// Marshal HTTP request\n$request = Marshaller::createJsonMarshaller()-\u003emarshalStructuredRequest($event);\n$request = Marshaller::createJsonMarshaller()-\u003emarshalBinaryRequest($event);\n$request = Marshaller::createJsonMarshaller()-\u003emarshalBatchRequest($events);\n\n// Marshal HTTP response\n$request = Marshaller::createJsonMarshaller()-\u003emarshalStructuredResponse($event);\n$request = Marshaller::createJsonMarshaller()-\u003emarshalBinaryResponse($event);\n$request = Marshaller::createJsonMarshaller()-\u003emarshalBatchResponse($events);\n\n// Unmarshal HTTP message\n$events = Unmarshaller::createJsonUnmarshaller()-\u003eunmarshal($message);\n```\n\n## Testing\n\nYou can use `composer` to build and run test environments when contributing.\n\n```\n$ composer run -l\n\nscripts:\n  lint          Show all current linting errors according to PSR12\n  lint-fix      Show and fix all current linting errors according to PSR12\n  sa            Run the static analyzer\n  tests         Run all tests locally\n  tests-build   Build containers to test against supported PHP versions\n  tests-docker  Run tests within supported PHP version containers\n```\n\n## Community\n\n- There are bi-weekly calls immediately following the [Serverless/CloudEvents\n  call](https://github.com/cloudevents/spec#meeting-time) at\n  9am PT (US Pacific). Which means they will typically start at 10am PT, but\n  if the other call ends early then the SDK call will start early as well.\n  See the [CloudEvents meeting minutes](https://docs.google.com/document/d/1OVF68rpuPK5shIHILK9JOqlZBbfe91RNzQ7u_P7YCDE/edit#)\n  to determine which week will have the call.\n- Slack: #cloudeventssdk channel under\n  [CNCF's Slack workspace](https://slack.cncf.io/).\n- Email: https://lists.cncf.io/g/cncf-cloudevents-sdk\n- Contact for additional information: Denis Makogon (`@denysmakogon` on slack).\n\nEach SDK may have its own unique processes, tooling and guidelines, common\ngovernance related material can be found in the\n[CloudEvents `community`](https://github.com/cloudevents/spec#community-and-docs)\ndirectory. In particular, in there you will find information concerning\nhow SDK projects are\n[managed](https://github.com/cloudevents/spec/blob/main/docs/SDK-GOVERNANCE.md),\n[guidelines](https://github.com/cloudevents/spec/blob/main/docs/SDK-maintainer-guidelines.md)\nfor how PR reviews and approval, and our\n[Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)\ninformation.\n\nIf there is a security concern with one of the CloudEvents specifications, or\nwith one of the project's SDKs, please send an email to\n[cncf-cloudevents-security@lists.cncf.io](mailto:cncf-cloudevents-security@lists.cncf.io).\n\n## Additional SDK Resources\n\n- [List of current active maintainers](MAINTAINERS.md)\n- [How to contribute to the project](CONTRIBUTING.md)\n- [SDK's License](LICENSE)\n- [SDK's Release process](RELEASING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudevents%2Fsdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudevents%2Fsdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudevents%2Fsdk-php/lists"}