{"id":33981213,"url":"https://github.com/tomahawkphp/queue","last_synced_at":"2025-12-13T03:38:40.431Z","repository":{"id":57071186,"uuid":"80208339","full_name":"tomahawkphp/queue","owner":"tomahawkphp","description":"Tomahawk Worker Queue","archived":false,"fork":false,"pushed_at":"2017-05-09T19:12:33.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T03:47:48.236Z","etag":null,"topics":["php","tomahawk-queue","worker-queue"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomahawkphp.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-27T13:11:34.000Z","updated_at":"2017-03-16T19:29:20.000Z","dependencies_parsed_at":"2022-08-24T14:54:26.268Z","dependency_job_id":null,"html_url":"https://github.com/tomahawkphp/queue","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tomahawkphp/queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomahawkphp%2Fqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomahawkphp%2Fqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomahawkphp%2Fqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomahawkphp%2Fqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomahawkphp","download_url":"https://codeload.github.com/tomahawkphp/queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomahawkphp%2Fqueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27699641,"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","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","tomahawk-queue","worker-queue"],"created_at":"2025-12-13T03:38:39.729Z","updated_at":"2025-12-13T03:38:40.415Z","avatar_url":"https://github.com/tomahawkphp.png","language":"PHP","readme":"# Tomahawk Queue\n\nA nice and simple PHP Worker Queue library\n\n\n## Requirements\n\n- PHP 7.0 +\n- pcntl extension.\n- posix extension.\n\n\n## Installation\n\nYou can install Tomahawk Queue using composer:\n\n`composer require tomahawk/queue`\n\n\n### 1. Setup configuration\n\nFirst you need to create a new file called `tomahawk.xml`\n\nYou will need to configure the following things:\n\n- Storage directory - for logs and pid files\n- Bootstrap file (optional) - Allows you to add event listeners and extend storage\n- Your workers\n\nBelow is an example:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003ctomahawk\n    storage=\"./storage\"\n    bootstrap=\"./queue-bootstrap.php\"\u003e\n\n    \u003cworkers\u003e\n        \u003cworker pidkey=\"emails\" name=\"Emails\" queues=\"emails\" /\u003e\n    \u003c/workers\u003e\n\n\u003c/tomahawk\u003e\n```\n\n\n### 2. Create Bootstrap file\n\nBootstrap example file\n\n```php\n\u003c?php\n\nuse Tomahawk\\Queue\\Application;\nuse Tomahawk\\Queue\\Storage\\StorageInterface;\nuse Tomahawk\\Queue\\Storage\\RedisStorage;\nuse Predis\\Client;\nuse Pimple\\Container;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcherInterface;\n\n/**\n * Get the Autoloader\n */\nrequire_once(__DIR__.'/vendor/autoload.php');\n\n/**\n * Set Default Timezone\n */\n\ndate_default_timezone_set('Europe/London');\n\n// Get the container\n$container = Application::getContainer();\n\n// Set storage for jobs\n$container[StorageInterface::class] = function(Container $c) {\n    $client = new Client([\n         'scheme' =\u003e 'tcp',\n         'host'   =\u003e '10.0.0.1',\n         'port'   =\u003e 6379,\n    ]);\n    return new RedisStorage($client);\n};\n\n$eventDispatcher = $container[EventDispatcherInterface::class];\n\n// Add events\n$eventDispatcher-\u003eaddListener(\\Tomahawk\\Queue\\JobEvents::PROCESSED, function(\\Tomahawk\\Queue\\Event\\PreProcessEvent $event) {\n    // Log to a file\n});\n\n$container[EventDispatcherInterface::class];\n\n```\n\n## Using the CLI\n\n### Create a new worker\n \n```./bin/tomahawk-queue work emails emails --daemon```\n\n### Queue a new job to worker\n \n```./bin/tomahawk-queue queue emails JobClass {\"id\":\"1\"}```\n\n### List running workers\n \n```./bin/tomahawk-queue list```\n\n### Stop a running worker\n \n```./bin/tomahawk-queue stop emails```\n\n### Load and run all workers defined in configuration file\n \n```./bin/tomahawk-queue load```\n\n## Using the Queue Manager\n\nIf you have your works setup on a different VM or server you can still push jobs onto the queue using the Queue Manager.\n\nBelow is an example of how to do this\n \n ```php\n \u003c?php \n \n use Predis\\Client;\n use Tomahawk\\Queue\\Manager;\n use Tomahawk\\Queue\\Storage\\RedisStorage;\n \n $client = new Client([\n      'scheme' =\u003e 'tcp',\n      'host'   =\u003e '10.0.0.1',\n      'port'   =\u003e 6379,\n ]);\n $storage = new RedisStorage($client);\n     \n $manager = new Manager($storage);\n \n $arguments = [\n     'email' =\u003e '...',\n     'subject' =\u003e '...',\n];\n \n $manager-\u003equeue('queue_email', 'JobClass', $arguments);\n ```\n\n## License\n\nTomahawk Queue is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomahawkphp%2Fqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomahawkphp%2Fqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomahawkphp%2Fqueue/lists"}