{"id":25933142,"url":"https://github.com/takuya/php-daemonize-pcntl","last_synced_at":"2025-03-04T00:52:17.726Z","repository":{"id":277508771,"uuid":"932643280","full_name":"takuya/php-daemonize-pcntl","owner":"takuya","description":"php-daemonize-pcntl","archived":false,"fork":false,"pushed_at":"2025-03-01T01:58:28.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T02:31:46.841Z","etag":null,"topics":["daemon","daemonize","pcntl","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuya.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-14T08:58:51.000Z","updated_at":"2025-03-01T01:58:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6bb0a59-ef78-4845-a289-ae469391b67e","html_url":"https://github.com/takuya/php-daemonize-pcntl","commit_stats":null,"previous_names":["takuya/php-daemonize-pcntl"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-daemonize-pcntl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-daemonize-pcntl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-daemonize-pcntl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-daemonize-pcntl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuya","download_url":"https://codeload.github.com/takuya/php-daemonize-pcntl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763737,"owners_count":20016162,"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":["daemon","daemonize","pcntl","php"],"created_at":"2025-03-04T00:52:17.116Z","updated_at":"2025-03-04T00:52:17.718Z","avatar_url":"https://github.com/takuya.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-daemonize-pcntl\n\ndaemonize function by pcntl_fork.   \n\n## php daemon Daemonize all\n\nDaemonize any process , written by php ( pcntl )\n\n\n## installing \n\nfrom Packagist\n```shell\ncomposer require takuya/php-daemonize-pcntl\n```\nfrom GitHub\n```shell\nname='php-daemonize-pcntl'\ncomposer config repositories.$name \\\nvcs https://github.com/takuya/$name  \ncomposer require takuya/$name:master\ncomposer install\n```\n\n## Examples \n\n### function / Daemonize ( detach tty and parent PID=1)  \n\n```php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\nuse Takuya\\PhpDaemonize\\PhpDaemonize;\n\n/**\n* Daemonize function\n */\n$m = new PhpDaemonize();\n$m-\u003estart(function () { sleep(1000); });\n$m-\u003estop();\n\n```\n### Run command as daemon\n```php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\nuse Takuya\\PhpDaemonize\\PhpDaemonize;\n\n/**\n* Daemonize function\n */\n$m = new PhpDaemonize();\n$m-\u003estart(function () { pcntl_exec('/usr/bin/sleep',[10]) });\n```\n\n## service (init.d)\n\nthis package help to make init.d service \n\nrun web server\n### my-server.sh\n```php\n#!/usr/bin/env php\nrequire_once 'vendor/autoload.php';\nuse Takuya\\PhpDaemonize\\PhpDaemonize;\n\n\n$name = 'my-server';\n// start stop\nPhpDaemonize::run_func(function(){\n  pcntl_exec('/usr/bin/php',['artisan','serve'])\n},$name);\n```\n\nstart and stop \n```shell\n./my-server.sh start\n./my-server.sh stop\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-daemonize-pcntl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuya%2Fphp-daemonize-pcntl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-daemonize-pcntl/lists"}