{"id":15018986,"url":"https://github.com/noweh/php-soundcloud","last_synced_at":"2025-09-13T00:32:09.901Z","repository":{"id":45568806,"uuid":"421491469","full_name":"noweh/php-soundcloud","owner":"noweh","description":"A PHP Wrapper for the Soundcloud REST API endpoints","archived":false,"fork":false,"pushed_at":"2021-12-17T14:50:41.000Z","size":21,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T14:38:55.198Z","etag":null,"topics":["api","php","soundcloud","soundcloud-api","soundcloud-player"],"latest_commit_sha":null,"homepage":"","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/noweh.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-26T15:58:48.000Z","updated_at":"2024-02-15T12:44:39.000Z","dependencies_parsed_at":"2022-09-01T16:20:39.394Z","dependency_job_id":null,"html_url":"https://github.com/noweh/php-soundcloud","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Fphp-soundcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Fphp-soundcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Fphp-soundcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Fphp-soundcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noweh","download_url":"https://codeload.github.com/noweh/php-soundcloud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232802711,"owners_count":18578684,"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":["api","php","soundcloud","soundcloud-api","soundcloud-player"],"created_at":"2024-09-24T19:52:43.355Z","updated_at":"2025-01-07T00:02:11.387Z","avatar_url":"https://github.com/noweh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SoundCloud API for PHP\n\n![SoundCloud](https://img.shields.io/static/v1?style=flat-square\u0026message=SoundCloud\u0026color=FF3300\u0026logo=SoundCloud\u0026logoColor=FFFFFF\u0026label=)\n![PHP](https://img.shields.io/badge/PHP-v7.3-828cb7.svg?style=flat-square\u0026logo=php)\n[![MIT Licensed](https://img.shields.io/github/license/noweh/php-soundcloud)](licence.md)\n[![last version](https://img.shields.io/packagist/v/noweh/php-soundcloud)](https://packagist.org/packages/noweh/php-soundcloud)\n\nA PHP Wrapper for the SoundCloud REST API endpoints.\n\n## Installation\nFirst, you need to add the component to your composer.json\n```\ncomposer require noweh/php-soundcloud\n```\nUpdate your packages with *composer update* or install with *composer install*.\n\n## Usage\n\nFor the calls to be valid, you must follow a few steps :\n\n\nFirst, you have to create a new instance of the wrapper with the following parameters:\n\n```\nuse Noweh\\SoundcloudApi\\Soundcloud;\n\n$client = new SoundCloud(\n    {CLIENT_ID},\n    {CLIENT_SECRET},\n    {CALLBACK_URL}\n);\n```\n\n⚠️ Since [July 2021](https://developers.soundcloud.com/blog/security-updates-api), most calls to SoundCloud REST API requires an `access_token`.\n\n⚠️ `{CALLBACK_URL}` must be the same as the one indicated in your SoundCloud account.\n\nSecond, you have to redirect the user to the SoundCloud login page:\n```\n...\nheader(\"Location: \" . $client-\u003egetAuthorizeUrl('a_custom_param_to_retrieve_in_callback'));\nexit();\n```\n\nOn your callback URL, you can call GET/POST/PUT/DELETE methods. The `access_token` will be automatically generated with the `code` parameter present in this URL.\n\nIf you want to use API calls in another page, you have to set manually this data:\n```\nuse Noweh\\SoundcloudApi\\Soundcloud;\n\n$client = new SoundCloud(\n    {CLIENT_ID},\n    {CLIENT_SECRET},\n    {CALLBACK_URL}\n);\n\n$client-\u003esetCode('3-134981-158678512-IwAXqypKWlDJCF');\n\n// API Call\n...\n```\n\n\n### Get Player Embed\n### This call does not require an access_token.\n\nTo retrieve the widget embed code for any SoundCloud URL pointing to a user, set, or a playlist, do the following:\n```\n... // Create a new instance of client\n\n// Required parameter\n$url = 'https://soundcloud.com/......';\n\n// Optional parameters\n$maxheight = 180;\n$sharing = true;\n$liking = true;\n$download = false;\n$show_comments = true;\n$show_playcount = false;\n$show_user = false;\n\ntry {\n    $response = $client-\u003egetPlayerEmbed($url, $maxheight, $sharing, $liking, $download, $show_comments, $show_playcount, $show_user)\n} catch (Exception $e) {\n    exit($e-\u003egetMessage());\n}\n```\n\n### GET\n```\n... // Create a new instance of client\n\ntry {\n    $response = $client-\u003eget('users/{CLIENT_ID}/tracks');\n} catch (Exit $e) {\n    exit($e-\u003egetMessage());\n}\n```\n\n### POST\n```\n... // Create a new instance of client\n\ntry {\n    $response = $client-\u003epost(\n        'tracks/1/comments',\n        [\n            'body' =\u003e 'a new comment'\n        ]\n    );\n} catch (Exception $e) {\n    exit($e-\u003egetMessage());\n}\n```\n\n### PUT\n```\n... // Create a new instance of client\n\ntry {\n    $response = $client-\u003eput(\n        'tracks/1',\n        [\n            'title' =\u003e 'my new title'\n        ]\n    );\n} catch (Exception $e) {\n    exit($e-\u003egetMessage());\n}\n```\n\n### DELETE\n```\n... // Create a new instance of client\n\ntry {\n    $response = $client-\u003edelete('tracks/1');\n} catch (Exception $e) {\n    exit($e-\u003egetMessage());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoweh%2Fphp-soundcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoweh%2Fphp-soundcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoweh%2Fphp-soundcloud/lists"}