{"id":17209452,"url":"https://github.com/jmathai/cloudexperience-php","last_synced_at":"2025-03-25T11:42:20.215Z","repository":{"id":66390451,"uuid":"6343954","full_name":"jmathai/CloudExperience-PHP","owner":"jmathai","description":"PHP SDK for the CloudExperience (CX.com) API","archived":false,"fork":false,"pushed_at":"2012-10-22T23:56:04.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T10:42:07.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jmathai.png","metadata":{"files":{"readme":"Readme.markdown","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}},"created_at":"2012-10-22T23:24:01.000Z","updated_at":"2014-04-17T05:54:00.000Z","dependencies_parsed_at":"2023-02-20T03:30:51.843Z","dependency_job_id":null,"html_url":"https://github.com/jmathai/CloudExperience-PHP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmathai%2FCloudExperience-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmathai%2FCloudExperience-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmathai%2FCloudExperience-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmathai%2FCloudExperience-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmathai","download_url":"https://codeload.github.com/jmathai/CloudExperience-PHP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458061,"owners_count":20618693,"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":[],"created_at":"2024-10-15T02:51:37.954Z","updated_at":"2025-03-25T11:42:20.187Z","avatar_url":"https://github.com/jmathai.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP SDK for the CloudExperience SDK\n===================================\n\n### Overview\nThis is a PHP library to authenticate with and call any API in the CloudExperience API.\n\nMost of these examples can be found in the included `examples.php` file.\n\n### Initialization\n\nYour *client id* and *client secret* can be found on the Mashery site under your Cloud Experience apps.\n\n    include 'CloudExperience.php';\n    $cx = new CloudExperience('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');\n\n### Authorization\n\nIf the user hasn't yet granted access to your app you'll need to obtain an access token from CloudExperience to their account. An overview of OAuth2 is out of the scope of this document but you can Google it if you'd like. With this library you won't need to really know the underlying details of OAuth.\n\n    // get the authorization URL\n    $cx-\u003egetAuthorizationUrl('https://yoursite.com');\n        // https://www.cx.com/mycx/oauth/authorize?client_id=your_client_id\u0026redirect_uri=https%3A%2F%2Fyoursite.com\n\nRedirect the user to the *Authorization URL* and once the user approves your app they'll be redirected to the callback URL you specified. The request will include a *GET* parameter named `authorization_code` which we'll pass back to CloudExperience in exchange for an access token.\n\n    // obtaining an access token\n    $cx-\u003egetAccessToken('your_code', 'https://google.com')\n        //  array(3) {\n        //    [\"token_type\"]=\u003e\n        //    string(6) \"bearer\"\n        //    [\"mapi\"]=\u003e\n        //    string(24) \"your_client_id\"\n        //    [\"access_token\"]=\u003e\n        //    string(24) \"user_access_token\"\n        //  }\n\nYou'll want to save the `access_token` so you can access protected APIs for this user. Before you access these APIs you'll need to set the access token.\n\n    // set the access token\n    $cx-\u003esetAccessToken('user_access_token');\n    \n    // you can also set the access token when initializeing the CloudExperience object\n    $cx = new CloudExperience('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'USER_ACCESS_TOKEN);\n\n### Making API calls\n\nOnce you've been granted access to the user's account and set the access token you can make a call to get the user's information.\n\nYou can use the `get`, `post` and `upload` methods.\n\n    // make a call to /users/self\n    $cx-\u003eget('/users/self');\n        //  array(1) {\n        //    [\"profile\"]=\u003e\n        //    array(6) {\n        //      [\"id\"]=\u003e\n        //      string(22) \"some_id\"\n        //      [\"username\"]=\u003e\n        //      string(7) \"your_username\"\n        //    }\n        //  }\n\n### Uploading files\n\nUploading files works the same way as all other API calls. Make sure you prepend the file name with an '@' sign as you see below.\n\n    $params = array(\n      'file_content_type' =\u003e 'image/jpg',\n      'file' =\u003e '@foobar.jpg'\n    );\n    $cx-\u003eupload('/data/self:/foobar.jpg', $params);\n        //  Array(14) {\n        //    [\"id\"]=\u003e\n        //    string(22) \"some_id\"\n        //    [\"version\"]=\u003e\n        //    int(1)\n        //    [\"created\"]=\u003e\n        //    string(24) \"2012-10-22T21:26:47.700Z\"\n        //    [\"modified\"]=\u003e\n        //    [\"shares\"]=\u003e\n        //    array(0) {\n        //    }\n        //    [\"stats\"]=\u003e\n        //    array(1) {\n        //      [\"comments\"]=\u003e\n        //      int(0)\n        //    }\n        //    [\"suspended\"]=\u003e\n        //    bool(false)\n        //  }\n                \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmathai%2Fcloudexperience-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmathai%2Fcloudexperience-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmathai%2Fcloudexperience-php/lists"}