{"id":22743391,"url":"https://github.com/stape-io/stape-sgtm-php","last_synced_at":"2025-04-14T08:51:31.261Z","repository":{"id":193292213,"uuid":"688510904","full_name":"stape-io/stape-sgtm-php","owner":"stape-io","description":"Stape sGTM PHP SDK","archived":false,"fork":false,"pushed_at":"2024-07-07T10:03:21.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-05T17:01:48.460Z","etag":null,"topics":["gtm","gtm-server-side","php","sdk","sdk-php","stape"],"latest_commit_sha":null,"homepage":"https://stape.io","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/stape-io.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}},"created_at":"2023-09-07T13:51:23.000Z","updated_at":"2025-03-30T07:58:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f335a02-3892-438d-8c90-80c5843e9fcf","html_url":"https://github.com/stape-io/stape-sgtm-php","commit_stats":null,"previous_names":["stape-io/stape-sgtm-php"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stape-io%2Fstape-sgtm-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stape-io%2Fstape-sgtm-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stape-io%2Fstape-sgtm-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stape-io%2Fstape-sgtm-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stape-io","download_url":"https://codeload.github.com/stape-io/stape-sgtm-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852084,"owners_count":21171837,"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":["gtm","gtm-server-side","php","sdk","sdk-php","stape"],"created_at":"2024-12-11T01:22:04.813Z","updated_at":"2025-04-14T08:51:31.237Z","avatar_url":"https://github.com/stape-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stape sGTM PHP SDK\n\nA PHP SDK to send tracking events to server-side GTM containers. Works in conjunction with Data Client.\n\n## Getting Started\n\n### Configuration\n\nFill in the basic parameters:\n\n```php\nuse Stape\\Sgtm\\StapeSGTM;\n\n$sgtm = StapeSGTM::create('https://gtm.example.com', '/data');\n```\n\n| Variable         | Description             |\n|------------------|-------------------------|\n| $gtmServerDomain | Server host             |\n| $requestPath     | Request processing path |\n\n\n### Sending Event Data\n\n```php\n$sgtm-\u003esendEventData(\u003c$eventName\u003e, \u003c$eventData\u003e);\n```\n\n| Variable   | Description                             |\n|------------|-----------------------------------------|\n| $eventName | Event name                              |\n| $eventData | Array of options for forming event data |\n\n\n**$eventData**\n\n```php\n$eventData = [\n  'page_hostname' =\u003e 'Stape',\n  'page_location' =\u003e 'http://stape.io',\n  'page_path' =\u003e '/',\n  'user_data' =\u003e [\n    'sha256_email_address' =\u003e Transforms::sha256hex('jhonn@doe.com'),\n    'address' =\u003e [\n      'first_name' =\u003e 'Jhon',\n    ],\n  ],\n];\n```\n\n####  Transforms\n\n| Option       | Description                                                |\n|--------------|------------------------------------------------------------|\n| trim         | Removes whitespace from the beginning and end of the value |\n| base64       | Encodes the string in Base64 format                        |\n| md5          | Encodes the string in MD5 format                           |\n| sha256base64 | Encodes the string in SHA256 Base64 format                 |\n| sha256hex    | Encodes the string in SHA256 HEX format                    |\n\n\n### Full Example\n\n```php\nnamespace Stape\\Sgtm\\Example;\n\nuse Stape\\Sgtm\\StapeSGTM;\nuse Stape\\Sgtm\\Transforms;\n\nrequire_once __DIR__  . '/../vendor/autoload.php';\n\n$start = StapeSGTM::create('https://gtm.stape.io', '/data?dhjdf=123');\n\n$eventData = [\n    'client_id' =\u003e '123456',\n    'currency' =\u003e 'USD',\n    'ip_override' =\u003e '79.144.123.69',\n    'language' =\u003e 'en',\n    'page_encoding' =\u003e 'UTF-8',\n    'page_hostname' =\u003e 'Stape',\n    'page_location' =\u003e 'http://stape.io',\n    'page_path' =\u003e '/',\n    'user_data' =\u003e [\n        'sha256_email_address' =\u003e Transforms::sha256hex('jhonn@doe.com'),\n        'phone_number' =\u003e '123456769',\n        'address' =\u003e [\n            'first_name' =\u003e 'Jhon',\n        ],\n    ],\n];\n\nvar_dump($start-\u003esendEventData('page_view', $eventData));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstape-io%2Fstape-sgtm-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstape-io%2Fstape-sgtm-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstape-io%2Fstape-sgtm-php/lists"}