{"id":41239691,"url":"https://github.com/crit/php-exec-jobs","last_synced_at":"2026-01-23T01:15:44.057Z","repository":{"id":56959341,"uuid":"189491258","full_name":"crit/php-exec-jobs","owner":"crit","description":"Execute shell scripts in order with named arguments and error checking.","archived":false,"fork":false,"pushed_at":"2019-06-03T23:21:19.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-30T14:02:09.658Z","etag":null,"topics":["php","shell"],"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/crit.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}},"created_at":"2019-05-30T22:36:00.000Z","updated_at":"2024-04-30T14:02:09.659Z","dependencies_parsed_at":"2022-08-21T05:10:22.504Z","dependency_job_id":null,"html_url":"https://github.com/crit/php-exec-jobs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/crit/php-exec-jobs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crit%2Fphp-exec-jobs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crit%2Fphp-exec-jobs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crit%2Fphp-exec-jobs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crit%2Fphp-exec-jobs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crit","download_url":"https://codeload.github.com/crit/php-exec-jobs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crit%2Fphp-exec-jobs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28676953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"ssl_error","status_checked_at":"2026-01-23T01:00:19.529Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["php","shell"],"created_at":"2026-01-23T01:15:43.219Z","updated_at":"2026-01-23T01:15:44.030Z","avatar_url":"https://github.com/crit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-exec-jobs\n\nExecute shell scripts in order with named arguments and error checking.\n\n## Installation\n\n`composer require crit/php-exec-jobs`\n\n## Reason\n\nYou can accomplish something similar to this library by executing the following code for simple use cases:\n\n```php\n\u003c?php\n$interface = $_GET['interface'];\n$interface = escapeshellarg($interface); // sometimes this step is incorrectly skipped by developers\n$ip = exec(\"ip addr show dev $interface |grep inet |awk '{print $2}'\");\n\necho $ip;\n```\n\n- What if you want to handle errors (like if `ip` does not exist on the host)? \n- What if you want to do many operations in a single request? \n\nThis library aims to help with that process. It represents the research needed to capture\nerrors/output using `proc_open()` and giving you the ability to safely parametrize arguments to the shell if needed.\n\n## Usage\n\n```php\n\u003c?php\n\nuse Crit\\ExecJob\\Job;\n\n$job = new Job();\n\n// optionally change the wrapping for named arguments \n// defaulted to '\u003c', '\u003e'\n// $job-\u003esetArgWrapper(':', ':');\n\n// optionally change the shell working directory\n// defaulted to the current working directory of the PHP process\n// $job-\u003esetWorkingDirectory('/sbin');\n\n// optionally set ENV variables for this job\n// $job-\u003esetEnv('CUSTOM1', 'special-value-1');\n// $job-\u003esetEnv('CUSTOM2', 'special-value-2');\n\n$job-\u003earg('firstname', $_GET['firstname']); // John\n$job-\u003earg('lastname', $_GET['lastname']); // Doe\n$job-\u003earg('interface', $_GET['interface']); // eth0\n\n$job-\u003emust('echo \"\u003cfirstname\u003e \u003clastname\u003e\"'); // stops here if shell errors\n$job-\u003emay('ip addr show dev \u003cinterface\u003e |grep inet |awk \\'{print $2}\\''); // will not stop here if shell errors\n$job-\u003emay('ifconfig \u003cinterface\u003e |grep inet |awk \\'{print $2}\\''); // will not stop here if shell errors\n$job-\u003emust('/sbin/someCustomScript \u003cfirstname\u003e \u003clastname\u003e');\n\n$ok = $job-\u003erun(); // run commands in order\n\necho \"Output: \" . json_encode($job-\u003eoutput());\necho \"Errors: \" . json_encode($job-\u003eerrors());\n\necho $ok ? \"Run successful\" : \"Run failed\";\n```\n\n### Output\n\n```\n\u003e Output: [\"John Doe\", null, \"192.168.10.16\", \"Hello, John Doe!\"]\n\u003e Errors: [null, \"sh: command not found: ip\", null, null]\n\u003e Run successful\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrit%2Fphp-exec-jobs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrit%2Fphp-exec-jobs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrit%2Fphp-exec-jobs/lists"}