{"id":16774999,"url":"https://github.com/sinanbekar/python-laravel-queue","last_synced_at":"2025-04-10T20:08:33.519Z","repository":{"id":57457165,"uuid":"447157486","full_name":"sinanbekar/python-laravel-queue","owner":"sinanbekar","description":"Sync Laravel queue with Python. Provides an interface for communication between Laravel and Python. ","archived":false,"fork":false,"pushed_at":"2022-01-12T12:13:25.000Z","size":9,"stargazers_count":7,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T17:52:43.802Z","etag":null,"topics":["laravel","laravel-queue","python","python-queue","queue","redis"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/python-laravel-queue/","language":"Python","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/sinanbekar.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":"2022-01-12T09:38:59.000Z","updated_at":"2023-11-06T16:38:18.000Z","dependencies_parsed_at":"2022-09-05T18:11:49.994Z","dependency_job_id":null,"html_url":"https://github.com/sinanbekar/python-laravel-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbekar%2Fpython-laravel-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbekar%2Fpython-laravel-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbekar%2Fpython-laravel-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbekar%2Fpython-laravel-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinanbekar","download_url":"https://codeload.github.com/sinanbekar/python-laravel-queue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288350,"owners_count":21078903,"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":["laravel","laravel-queue","python","python-queue","queue","redis"],"created_at":"2024-10-13T06:50:42.850Z","updated_at":"2025-04-10T20:08:33.495Z","avatar_url":"https://github.com/sinanbekar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Python Laravel Queue\n\nQueue sync between Python and Laravel using Redis driver. You can process jobs dispatched from Laravel in Python.\n\n**NOTE: This package is in beta and only Redis is supported currently. Production usage is not recommended until stable release.**\n\nIn the 1.0.0 stable version these implementations are planned:\n\n- Auto-discovery jobs in both Laravel and Python.\n- Auto-configuration by reading Laravel config in Python side.\n- More clean API.\n- Supporting more queue drivers.\n\n### Install\n\n```bash\npip install python-laravel-queue\n```\n\n### Usage\n\n- Listen for jobs on Python:\n\n```python\nfrom python_laravel_queue import Queue as PlQueue\nfrom redis import Redis\n\nr = Redis(host='localhost', port=6379, db=0)\nqueue_python = PlQueue(r, queue='python')\n\n@queue_python.handler\ndef handle(data):\n    name = data['name'] # job name\n    data = data['data'] # job data\n    print('TEST: ' + data['a'] + ' ' + data['b'] + ' ' + data['c'])\n\nqueue_python.listen()\n```\n\n- Sending jobs from Laravel :\n\n```php\n\u003c?php\n$job = new \\App\\Jobs\\TestJob('hi','send to','python');\ndispatch($job)-\u003eonQueue('python');\n```\n\n- Schedule a job to be run in Laravel from Python:\n\n```python\nfrom python_laravel_queue import Queue as PlQueue\nfrom redis import Redis\n\nr = Redis(host='localhost', port=6379, db=0)\nqueue_laravel = PlQueue(r, queue='laravel')\nqueue_laravel.push('App\\\\Jobs\\\\TestJob', {'a': 'hello', 'b': 'send to', 'c': 'laravel'})\n\n```\n\n**TestJob** in Laravel:\n\n```php\n\u003c?php\n\nnamespace App\\Jobs;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Illuminate\\Foundation\\Bus\\Dispatchable;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Support\\Facades\\Log;\n\nclass TestJob extends Job implements ShouldQueue\n{\n    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;\n\n    public $a, $b, $c;\n\n    /**\n     * Create a new job instance.\n     *\n     * @return void\n     */\n    public function __construct ($a, $b, $c) {\n        $this-\u003ea = $a;\n        $this-\u003eb = $b;\n        $this-\u003ec = $c;\n    }\n\n    public function handle () {\n        Log::info('TEST: ' . $this-\u003ea . ' '. $this-\u003eb . ' ' . $this-\u003ec);\n    }\n}\n\n```\n\n- You need to :listen (or :work) the preferred queue name above to handle data sent from Python in Laravel.\n\n```bash\nphp artisan queue:listen --queue=laravel\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinanbekar%2Fpython-laravel-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinanbekar%2Fpython-laravel-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinanbekar%2Fpython-laravel-queue/lists"}