{"id":19777929,"url":"https://github.com/datadome/fraud-sdk-symfony-package","last_synced_at":"2025-05-13T02:11:01.647Z","repository":{"id":205105161,"uuid":"694739144","full_name":"DataDome/fraud-sdk-symfony-package","owner":"DataDome","description":"Fraud Protection for PHP (Symphony)","archived":false,"fork":false,"pushed_at":"2025-02-27T08:21:45.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T05:51:14.008Z","etag":null,"topics":["fraud","php","sdk","symphony"],"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/DataDome.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-21T15:37:32.000Z","updated_at":"2025-02-27T08:21:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfb4a0d8-8235-4cb2-a70c-865fcf5dc858","html_url":"https://github.com/DataDome/fraud-sdk-symfony-package","commit_stats":null,"previous_names":["datadome/fraud-sdk-symfony-package"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDome%2Ffraud-sdk-symfony-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDome%2Ffraud-sdk-symfony-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDome%2Ffraud-sdk-symfony-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDome%2Ffraud-sdk-symfony-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDome","download_url":"https://codeload.github.com/DataDome/fraud-sdk-symfony-package/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856656,"owners_count":21974582,"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":["fraud","php","sdk","symphony"],"created_at":"2024-11-12T05:27:07.366Z","updated_at":"2025-05-13T02:11:01.624Z","avatar_url":"https://github.com/DataDome.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataDome Fraud Protection - PHP Symfony integration\n\nModule for supporting DataDome Fraud Protection in Symfony PHP applications.\n\n## Installation\n\nThis package can be installed through composer by running the following command:\n\n```\ncomposer require datadome/fraud-sdk-symfony\n```\n\nThen proceed to run the below command to generate an autoloader containing the main class and options:\n\n```\ncomposer dump-autoload\n```\n\n## Usage\n\nUpdate the .env files with your preferred configuration. \nPlease note that the `DATADOME_FRAUD_API_KEY` is mandatory, while the other two settings are optional.\n\n```\nDATADOME_FRAUD_API_KEY=my-datadome-client-side-sdk-key\nDATADOME_TIMEOUT=1500\nDATADOME_ENDPOINT='https://account-api.datadome.co'\n```\n\nTo make use of the DataDome SDK in your controller, first add the required imports:\n\n```php\nuse DataDome\\FraudSdkSymfony\\Config\\DataDomeOptions;\nuse DataDome\\FraudSdkSymfony\\DataDome;\nuse DataDome\\FraudSdkSymfony\\Models\\Address;\nuse DataDome\\FraudSdkSymfony\\Models\\LoginEvent;\nuse DataDome\\FraudSdkSymfony\\Models\\StatusType;\nuse DataDome\\FraudSdkSymfony\\Models\\RegistrationEvent;\nuse DataDome\\FraudSdkSymfony\\Models\\Session;\nuse DataDome\\FraudSdkSymfony\\Models\\User;\nuse DataDome\\FraudSdkSymfony\\Models\\ResponseAction;\n```\n\nThen proceed to create a private DataDome object as follows:\n\n```php\n$key = $_ENV['DATADOME_FRAUD_API_KEY'];\n$timeout = $_ENV['DATADOME_TIMEOUT'];\n$endpoint = $_ENV['DATADOME_ENDPOINT'];\n\n$options = new DataDomeOptions($key, $timeout, $endpoint);\n$this-\u003edataDome = new DataDome($options);\n```\n\nFinally, invoke the validate and collect methods as required:\n\n```php\nif ($this-\u003evalidateLogin(\"account_guid_to_check\")) {\n    $loginEvent = new LoginEvent(\"account_guid_to_check\", StatusType::Succeeded);\n    $loginResponse = $this-\u003edataDome-\u003evalidate($request, $loginEvent);\n\n    if ($loginResponse != null \u0026\u0026 $loginResponse-\u003eaction == ResponseAction::Allow-\u003ejsonSerialize()) {\n        // Valid login attempt\n        return new JsonResponse([true]);\n    } else {\n        // Business Logic here\n        // MFA\n        // Challenge\n        // Notification email\n        // Temporarily lock account\n        return new JsonResponse([\"Login denied\"]);\n    }\n}\nelse {\n    $loginEvent = new LoginEvent(\"account_guid_to_check\", StatusType::Failed);\n    $this-\u003edataDome-\u003ecollect($request, $loginEvent);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadome%2Ffraud-sdk-symfony-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatadome%2Ffraud-sdk-symfony-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadome%2Ffraud-sdk-symfony-package/lists"}