{"id":15691630,"url":"https://github.com/wyrihaximus/php-cpu-core-detector","last_synced_at":"2025-07-08T18:08:41.350Z","repository":{"id":37550476,"uuid":"48770627","full_name":"WyriHaximus/php-cpu-core-detector","owner":"WyriHaximus","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-31T06:48:12.000Z","size":443,"stargazers_count":8,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-25T10:53:40.388Z","etag":null,"topics":["cpu","hacktoberfest","php","reactphp"],"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/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"WyriHaximus"}},"created_at":"2015-12-29T22:54:53.000Z","updated_at":"2024-10-31T06:48:16.000Z","dependencies_parsed_at":"2024-11-16T16:04:04.576Z","dependency_job_id":"d55faa38-3aa7-40bb-8b96-50d4136e73f5","html_url":"https://github.com/WyriHaximus/php-cpu-core-detector","commit_stats":{"total_commits":109,"total_committers":4,"mean_commits":27.25,"dds":0.5229357798165137,"last_synced_commit":"f0a18b7ffc4f5647b11a75ae970c39b9c9758526"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/WyriHaximus/php-cpu-core-detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-cpu-core-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-cpu-core-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-cpu-core-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-cpu-core-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/php-cpu-core-detector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Fphp-cpu-core-detector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264321050,"owners_count":23590574,"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":["cpu","hacktoberfest","php","reactphp"],"created_at":"2024-10-03T18:22:34.990Z","updated_at":"2025-07-08T18:08:41.316Z","avatar_url":"https://github.com/WyriHaximus.png","language":"PHP","funding_links":["https://github.com/sponsors/WyriHaximus"],"categories":[],"sub_categories":[],"readme":"# PHP CPU Core Count Detection\n\nThis PHP script detects the number of CPU cores available on a Linux server. It can be helpful for optimizing performance in multi-threaded applications by dynamically assessing hardware capabilities.\n\n## Purpose\n\nThis tool enables developers to retrieve the number of CPU cores on a Linux server using PHP. This is especially useful for performance optimizations and load balancing in server environments.\n\n## Features\n\n- Detects the number of CPU cores on Linux-based systems.\n- Utilizes shell commands (`hash`, `nproc`, `taskset`) to gather system information.\n- Lightweight and easy to integrate into existing PHP applications.\n\n## Supported OS/Programs\n\nCurrently supports **Linux** only, using the following utilities:\n- `hash`\n- `nproc`\n- `taskset`\n\n## Clone this repository:\n\n```bash\ngit clone https://github.com/your-user/php-cpu-core-detection.git\n```\n\n## Contributing\nContributions are welcome! To contribute:\n\n1. Fork this repository.\n2. Make your changes in a new branch.\n3. Submit a pull request with a detailed description of your changes.\n\n## Examples\n\nCheck out these examples to see the CPU core detection in action:\n ### Async\n ```\n $loop = Factory::create();\n\nDetector::detectAsync($loop)-\u003ethen(function ($result): void {\n    echo $result, \\PHP_EOL;\n    for ($i = 0; $i \u003c $result; $i++) {\n        Resolver::resolve($i, 'uptime')-\u003ethen(function ($cmd): void {\n            echo $cmd, \\PHP_EOL;\n        });\n    }\n});\n\n$loop-\u003erun();\n ```\n \n [Full Example](examples/async.php)\n \n ### Sync\n ```\n$result = Detector::detect();\necho $result, \\PHP_EOL;\n\nfor ($i = 0; $i \u003c $result; $i++) {\n    Resolver::resolve((string)$i, 'uptime')-\u003ethen(function ($cmd): void {\n        echo $cmd, \\PHP_EOL;\n    });\n}\n ```\n \n [Full Example](examples/sync.php)\n\n\n \n## License ##\n\nCopyright 2016 [Cees-Jan Kiewiet](http://wyrihaximus.net/)\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fphp-cpu-core-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Fphp-cpu-core-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Fphp-cpu-core-detector/lists"}