{"id":18924792,"url":"https://github.com/php-bundles/fork","last_synced_at":"2025-04-15T12:32:50.806Z","repository":{"id":57063654,"uuid":"60610226","full_name":"php-bundles/fork","owner":"php-bundles","description":"Fork Library","archived":false,"fork":false,"pushed_at":"2018-02-26T20:31:20.000Z","size":55,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T21:22:22.187Z","etag":null,"topics":["fork","php","process","symfony","symfony-bundle"],"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/php-bundles.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":"2016-06-07T12:09:00.000Z","updated_at":"2024-03-14T20:02:33.000Z","dependencies_parsed_at":"2022-08-24T14:01:12.298Z","dependency_job_id":null,"html_url":"https://github.com/php-bundles/fork","commit_stats":null,"previous_names":["symfony-bundles/fork"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-bundles%2Ffork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-bundles%2Ffork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-bundles%2Ffork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-bundles%2Ffork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-bundles","download_url":"https://codeload.github.com/php-bundles/fork/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072509,"owners_count":21208200,"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":["fork","php","process","symfony","symfony-bundle"],"created_at":"2024-11-08T11:08:11.315Z","updated_at":"2025-04-15T12:32:50.550Z","avatar_url":"https://github.com/php-bundles.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SymfonyBundles Fork Library\n===========================\n\n[![SensioLabsInsight][sensiolabs-insight-image]][sensiolabs-insight-link]\n\n[![Build Status][testing-image]][testing-link]\n[![Scrutinizer Code Quality][scrutinizer-code-quality-image]][scrutinizer-code-quality-link]\n[![Code Coverage][code-coverage-image]][code-coverage-link]\n[![Total Downloads][downloads-image]][package-link]\n[![Latest Stable Version][stable-image]][package-link]\n[![License][license-image]][license-link]\n\nInstallation\n------------\n\nInstall the library with composer:\n\n``` bash\ncomposer require symfony-bundles/fork\n```\n\nHow to use (only cli-mode)\n--------------------------\n\nCreate the fork service:\n\n``` php\nuse SymfonyBundles\\Fork;\n\n$fork = new Fork\\Fork();\n```\n\nCreate a task that implements an interface `SymfonyBundles\\Fork\\TaskInterface`.\nFor example:\n\n``` php\nnamespace AppBundle\\Task;\n\nuse SymfonyBundles\\Fork\\TaskInterface;\n\nclass DemoTask implements TaskInterface\n{\n    public function execute()\n    {\n        echo \"Hello World!\\n\";\n    }\n}\n```\n\nNow that the task is created, you can execute her in a plurality processes:\n\n``` php\nuse AppBundle\\Task\\DemoTask;\n\n$task = new DemoTask();\n\n$fork-\u003eattach($task)-\u003erun(4)-\u003ewait(); // 4 - this is number of subprocesses\n```\n\nAnd another example:\n``` php\n$task1 = new DemoTask();\n$task2 = new DemoTask();\n$task3 = new DemoTask();\n\n$fork-\u003eattach($task1)-\u003eattach($task2)-\u003eattach($task3);\n$fork-\u003erun(); // by default, the optimal number of subprocesses will be determined\n$fork-\u003ewait();\n```\n\nIf you call method `wait`, the current process (main) will wait while all child processes will be finished.\n\n[package-link]: https://packagist.org/packages/symfony-bundles/fork\n[license-link]: https://github.com/symfony-bundles/fork/blob/master/LICENSE\n[license-image]: https://poser.pugx.org/symfony-bundles/fork/license\n[testing-link]: https://travis-ci.org/symfony-bundles/fork\n[testing-image]: https://travis-ci.org/symfony-bundles/fork.svg?branch=master\n[stable-image]: https://poser.pugx.org/symfony-bundles/fork/v/stable\n[downloads-image]: https://poser.pugx.org/symfony-bundles/fork/downloads\n[sensiolabs-insight-link]: https://insight.sensiolabs.com/projects/83639a9c-881b-4738-b3e9-ea304600c900\n[sensiolabs-insight-image]: https://insight.sensiolabs.com/projects/83639a9c-881b-4738-b3e9-ea304600c900/big.png\n[code-coverage-link]: https://scrutinizer-ci.com/g/symfony-bundles/fork/?branch=master\n[code-coverage-image]: https://scrutinizer-ci.com/g/symfony-bundles/fork/badges/coverage.png?b=master\n[scrutinizer-code-quality-link]: https://scrutinizer-ci.com/g/symfony-bundles/fork/?branch=master\n[scrutinizer-code-quality-image]: https://scrutinizer-ci.com/g/symfony-bundles/fork/badges/quality-score.png?b=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-bundles%2Ffork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-bundles%2Ffork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-bundles%2Ffork/lists"}