{"id":15318371,"url":"https://github.com/appleboy/drone-php-curl","last_synced_at":"2025-02-26T06:32:41.704Z","repository":{"id":66187369,"uuid":"95895842","full_name":"appleboy/drone-php-curl","owner":"appleboy","description":"php curl for drone plugin","archived":false,"fork":false,"pushed_at":"2017-07-01T16:26:17.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-29T01:10:05.786Z","etag":null,"topics":["drone-plugin","php-curl"],"latest_commit_sha":null,"homepage":null,"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/appleboy.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}},"created_at":"2017-06-30T14:25:37.000Z","updated_at":"2021-05-02T14:39:46.000Z","dependencies_parsed_at":"2023-02-21T17:00:44.405Z","dependency_job_id":null,"html_url":"https://github.com/appleboy/drone-php-curl","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"e200dbb687075ff8b7e21ec6ea6ccb00419a52d4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-php-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-php-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-php-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-php-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleboy","download_url":"https://codeload.github.com/appleboy/drone-php-curl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240133819,"owners_count":19753121,"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":["drone-plugin","php-curl"],"created_at":"2024-10-01T08:59:51.565Z","updated_at":"2025-02-26T06:32:41.597Z","avatar_url":"https://github.com/appleboy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example PHP Plugin\n\nThis provides a brief tutorial for creating a Drone webhook plugin, using simple `php` scripting, to make an http requests during the build pipeline. The below example demonstrates how we might configure a webhook plugin in the Yaml file:\n\n```yml\npipeline:\n  webhook:\n    image: foo/webhook\n    url: http://foo.com\n    method: post\n    body: |\n      hello world\n```\n\nCreate a simple shell script that invokes curl using the Yaml configuration parameters, which are passed to the script as environment variables in uppercase and prefixed with `PLUGIN_`.\n\n```php\n\u003c?php\n\n$method = getenv('PLUGIN_METHOD');\n$body = getenv('PLUGIN_BODY');\n$url = getenv('PLUGIN_URL');\n\ncurl_setopt($ch, CURLOPT_URL, $url);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\nif ($method === \"post\") {\n  curl_setopt($ch, CURLOPT_POST, 1);\n  curl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n}\n\n$output = curl_exec($ch);\ncurl_close($ch);\necho $output;\n```\n\nCreate a Dockerfile that adds your shell script to the image, and configures the image to execute your shell script as the main entrypoint.\n\n```dockerfile\nFROM laradock/workspace:1.8-71\n\nADD curl.php /\n\nENTRYPOINT [\"php\", \"curl.php\"]\n```\n\nBuild and publish your plugin to the Docker registry. Once published your plugin can be shared with the broader Drone community.\n\n```sh\ndocker build -t foo/webhook .\ndocker push foo/webhook\n```\n\nExecute your plugin locally from the command line to verify it is working:\n\n```sh\ndocker run --rm \\\n  -e PLUGIN_METHOD=post \\\n  -e PLUGIN_URL=http://foo.com \\\n  -e PLUGIN_BODY=\"hello world\" \\\n  foo/webhook\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fdrone-php-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleboy%2Fdrone-php-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fdrone-php-curl/lists"}