{"id":19943947,"url":"https://github.com/akiyamasm/laravel-same-request","last_synced_at":"2025-05-03T15:33:33.229Z","repository":{"id":61169286,"uuid":"548830532","full_name":"akiyamaSM/laravel-same-request","owner":"akiyamaSM","description":"The Missing check on Laravel Request Unicity. ","archived":false,"fork":false,"pushed_at":"2023-10-23T09:08:18.000Z","size":14,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T15:57:20.358Z","etag":null,"topics":["cache","eloquent","improvement","laravel","packages","php","sql","storage"],"latest_commit_sha":null,"homepage":"","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/akiyamaSM.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2022-10-10T08:48:50.000Z","updated_at":"2024-02-29T07:15:40.000Z","dependencies_parsed_at":"2022-10-12T02:32:32.527Z","dependency_job_id":null,"html_url":"https://github.com/akiyamaSM/laravel-same-request","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiyamaSM%2Flaravel-same-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiyamaSM%2Flaravel-same-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiyamaSM%2Flaravel-same-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akiyamaSM%2Flaravel-same-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akiyamaSM","download_url":"https://codeload.github.com/akiyamaSM/laravel-same-request/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224365891,"owners_count":17299247,"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":["cache","eloquent","improvement","laravel","packages","php","sql","storage"],"created_at":"2024-11-13T00:18:33.366Z","updated_at":"2024-11-13T00:18:33.910Z","avatar_url":"https://github.com/akiyamaSM.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Motivation\n\n[![Total Downloads](https://img.shields.io/packagist/dt/inani/laravel-same-request.svg?style=flat-square)]([https://packagist.org/packages/spatie/laravel-rate-limited-job-middleware](https://packagist.org/packages/inani/laravel-same-request))\n\nThis laravel package will allow you to execute a code once in the current request based on the key provided. \n\n## Installation\n\n````\ncomposer require inani/laravel-same-request\n````\n\nYou will(for L5) need to register the service provider in the  ````config/app.php```` .\n````php\nreturn [\n       /*\n         * Package Service Providers...\n         */\n\n        /*\n         * Application Service Providers...\n         */\n        App\\Providers\\AppServiceProvider::class,\n        App\\Providers\\AuthServiceProvider::class,\n        // App\\Providers\\BroadcastServiceProvider::class,\n        App\\Providers\\EventServiceProvider::class,\n        App\\Providers\\RouteServiceProvider::class,\n        Inani\\UniqueRequest\\UniqueRequestServiceProvider::class, // \u003c=== HERE\n];\n````\n\nYou will need to use the middleware or binding it globally in your  ````app/Http/Kernel.php````\n\n````php\nreturn [\n        'api' =\u003e [\n                'throttle:120,1',\n                'bindings',\n                PreventCache::class,\n                GetJwtFromCookie::class,\n                AddUniqueIdentifier::class\n         ],\n];\n````\n\n\n\n## Usage\n\n\n````php\n    for ($i= 0; $i \u003c 2; $i++){\n        $greeting = request()-\u003eonce(function (){\n            info('entred once');\n            return 'hello';\n        }, 'greeting');\n    }\n\n    $goodbye = request()-\u003eonce(function (){\n        return 'Saynoara';\n    }, 'bye');\n\n    $goodbye = request()-\u003eonce(function (){\n        return 'ByeBye';\n    }, 'bye');\n\n    return [$greeting, $goodbye];\n\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiyamasm%2Flaravel-same-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakiyamasm%2Flaravel-same-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiyamasm%2Flaravel-same-request/lists"}