{"id":18084878,"url":"https://github.com/coderofsalvation/webpipe.bash.php","last_synced_at":"2025-04-06T00:13:24.870Z","repository":{"id":14094602,"uuid":"16798684","full_name":"coderofsalvation/webpipe.bash.php","owner":"coderofsalvation","description":"php-skeleton to run bash webpipes using another server","archived":false,"fork":false,"pushed_at":"2020-05-28T19:31:53.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T06:21:43.736Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderofsalvation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://gumroad.com/l/hGYGh"}},"created_at":"2014-02-13T09:54:47.000Z","updated_at":"2020-05-28T19:31:55.000Z","dependencies_parsed_at":"2022-08-28T19:04:49.664Z","dependency_job_id":null,"html_url":"https://github.com/coderofsalvation/webpipe.bash.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/coderofsalvation%2Fwebpipe.bash.php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fwebpipe.bash.php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fwebpipe.bash.php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderofsalvation%2Fwebpipe.bash.php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderofsalvation","download_url":"https://codeload.github.com/coderofsalvation/webpipe.bash.php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415976,"owners_count":20935387,"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-31T15:08:29.461Z","updated_at":"2025-04-06T00:13:24.811Z","avatar_url":"https://github.com/coderofsalvation.png","language":"PHP","funding_links":["https://gumroad.com/l/hGYGh"],"categories":[],"sub_categories":[],"readme":"### webpipe.bash.php\n\nWebpipes are handy when you want to do powerfull bashscripting without the limitations of your current architecture/packages.\nThis repository contains one example webpipe 'json_print_r' which functions as an startingpoint for other webpipes.\n\n### Demonstration\n\nA demonstration of a tool which utilitizes webpipes can seen [here](https://bashlive.com)\n\n### Howto use\n\nAdviced is to use [bashlive](http://bashlive.com) or [webpipe.bash](https://github.com/coderofsalvation/webpipe.bash) so the webpipes appear as normal unix commands (as seen \nin the demonstration above).\nFor testing purposes also curl can be used directly (see the following section), to process:\n\n    curl -L -X POST -d 'putyourpostdatahere' -H Content-Type: text/plain http://myurl.com/json_print_r\n    curl -L -X POST -d 'putyourpostdatahere' -H Content-Type: text/html  http://myurl.com/json_print_r\n    curl -L -X POST -d 'putyourpostdatahere' -H Content-Type: text/csv   http://myurl.com/json_print_r\n\nOr to get the options:\n\n    curl -L -X OPTIONS -H 'Content-Type: text/plain' http://myurl.com/json_print_r\n\nAgain, this is a pretty cumbersome interfaces, adviced is to use [bashlive](http://bashlive.com) or [webpipe.bash](http://github.com/codersalvation/webpipe.bash) which automatically\n convert commandline arguments/options/input to GET/POST variables. For example, if you pass the '--help' or '--verbose' flag using these tools, you will automatically get debug- and/or help info.\n\n### normal vs webpipe\n\nInterestingly enough it looks like webpipes run faster than normal forks when run locally.\nThis is when we spawn php ourselves (it does a simple print_r( json_decode( $GLOBALS['argv'][1] ) );\n\n    $ time ./test.php '{\"foo\":[\"bar\",\"flop\",\"flap\"]}'\n\n    real    0m0.018s\n    user    0m0.009s\n    sys     0m0.006s\n\nAnd here's when we do it using a webpipe:\n\n    $ time curl -L -X POST -d '{\"foo\":[\"bar\",\"flop\",\"flap\"]}' -H 'Content-Type: text/plain' http://localhost/webpipes/json_print_r.php\n\n    real    0m0.008s\n    user    0m0.003s\n    sys     0m0.002s\n\nIm not exactly sure why this is faster, but I guess apache is already waiting with a default X running processes.\nIf for whatever reason this test is not valid let me know.\n\n### Compatibility with WebPipe Specification 0.2\n\nThe webpipes above are more or less compatible.\nNoted should be that the webpipes are used mainly as simple unix webpipes (text in, text out), hence the \nphp webpipe is defaulting to single-input, single-output (in contrast to the multi-jsoninput multi-jsonoutput requirement\nof the webpipe specification).\nHowever, the multi-jsoninput multi-jsonoutput requirement *does* apply when you call it with content-type 'application/json':\n    \n    $ curl -X POST -d '{\"inputs\":[{\"css\":\".foo { font-weight:bold; }\"}]}' -H 'Content-Type: application/json' http://localhost/json_print_r.php\n\nHowever, this multi-in multi-out-assumption of the specs doesnt really fit my needs, therefore for practical reasons contenttypes 'text/plain' and 'text/html' default \nto single-textinput single-textoutput..the default behaviour of any webserver.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fwebpipe.bash.php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderofsalvation%2Fwebpipe.bash.php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderofsalvation%2Fwebpipe.bash.php/lists"}