{"id":18463723,"url":"https://github.com/commandstring/ytdlp-php","last_synced_at":"2025-10-31T09:30:37.449Z","repository":{"id":65169007,"uuid":"585192139","full_name":"CommandString/YtDlp-PHP","owner":"CommandString","description":"A PHP wrapper for YtDlp","archived":false,"fork":false,"pushed_at":"2023-08-04T23:27:24.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T10:33:00.556Z","etag":null,"topics":[],"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/CommandString.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-01-04T14:52:26.000Z","updated_at":"2023-07-26T19:22:38.000Z","dependencies_parsed_at":"2024-12-25T07:46:23.391Z","dependency_job_id":"ad580a5f-3ae9-46b0-989b-bf80ceb372d7","html_url":"https://github.com/CommandString/YtDlp-PHP","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.1428571428571429,"last_synced_commit":"a8a3cf296602cb345ea677170132f8a8a01b0786"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FYtDlp-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FYtDlp-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FYtDlp-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FYtDlp-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CommandString","download_url":"https://codeload.github.com/CommandString/YtDlp-PHP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239162320,"owners_count":19592340,"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-11-06T09:07:47.765Z","updated_at":"2025-10-31T09:30:32.180Z","avatar_url":"https://github.com/CommandString.png","language":"PHP","readme":"# commandstring/yt-dlp\n\nA promised-based PHP wrapper for [YtDlp](https://github.com/yt-dlp/yt-dlp) built off ReactPHP\n\n**NOTE BEFORE USING YOU WILL NEED TO START A REACT/PROMISE LOOP OR THE SCRIPT WILL DIE BEFORE THE COMMAND FINISHES EXECUTING!!!**\n\n# Creating YtDlp\n\n```php\n$yt = new YtDlp();\n```\n\nYou can supply a path to your Yt-Dlp as well if it's not in your path.\n\n# CommandBuilder\n\nYou can use the command builder to create commands programmatically, all options for YtDlp exist inside `\\Yt\\Dlp\\Options` (if I'm missing anything please open an issue)\n\nYou can create a new CommandBuilder with your YtDlp instance\n\n```php\n$command = $yt-\u003enewCommand($url)-\u003eaddOption(Options::SKIP_DOWNLOAD)-\u003eaddOption(Options::DUMP_JSON);\n```\n\nYou can then use the execute method to execute. With the then method following that you can check the handle a success/failed command execution\n\n```php\n$command-\u003eexecute()-\u003ethen(function (string $result) {\n    echo $result;\n}, function (CommandExecutionFailed $e) {\n    echo (string)$e;\n});\n```\n\n# Already implemented commands\n\n```php\npublic function downloadVideo(string $url, string $outputPath, string $customName, string $format = \"mp4\"): PromiseInterface;\npublic function downloadAudio(string $url, string $outputPath, string $customName, string $format = \"mp3\"): PromiseInterface;\n```\nreturns the full path of where the audio/video was downloaded\n\n```php\npublic function getInfo(string $url): PromiseInterface\n```\nreturns an stdClass with the video info [Available Fields](https://github.com/yt-dlp/yt-dlp#output-template)\n\n```php\npublic function search(string $query, int $results = 1): PromiseInterface\n```\nReturns an array of all the results, each item has a structure similar to the getInfo method\n\n\n# Basic Usage\n\nThis code will download the first videos from the query\n\n```php\n\u003c?php\n\nuse React\\EventLoop\\Loop;\nuse Yt\\Dlp\\Exceptions\\CommandExecutionFailed;\nuse Yt\\Dlp\\YtDlp;\n\nrequire_once \"vendor/autoload.php\";\n\n$yt = new YtDlp();\n\n$errHandler = function (CommandExecutionFailed $e) {\n    echo (string)$e;\n};\n\n$query = \"amalee the worlds continuation\";\n\n$yt-\u003esearch($query, 5)-\u003ethen(function ($results) use ($yt, $errHandler) {\n    foreach ($results as $video) {\n        $id = $video-\u003eid;\n\n        $yt-\u003edownloadVideo($id, __DIR__, $id)-\u003ethen(null, $errHandler);\n    }\n});\n\nLoop::get()-\u003erun();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommandstring%2Fytdlp-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommandstring%2Fytdlp-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommandstring%2Fytdlp-php/lists"}