{"id":18495063,"url":"https://github.com/cgauge/laravel-php-session","last_synced_at":"2025-04-08T22:31:44.659Z","repository":{"id":44795383,"uuid":"300957568","full_name":"cgauge/laravel-php-session","owner":"cgauge","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-12T11:31:07.000Z","size":25,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-23T19:11:17.407Z","etag":null,"topics":["hacktoberfest","laravel","php","session"],"latest_commit_sha":null,"homepage":"","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/cgauge.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":"2020-10-03T19:07:51.000Z","updated_at":"2024-06-12T11:30:18.000Z","dependencies_parsed_at":"2024-06-12T13:45:51.765Z","dependency_job_id":"99333bca-7f7d-4dbf-96d4-94e0d832f387","html_url":"https://github.com/cgauge/laravel-php-session","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":0.1333333333333333,"last_synced_commit":"38efe3a1597a8680183aba3e622e9ba4aa44f0c7"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgauge%2Flaravel-php-session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgauge%2Flaravel-php-session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgauge%2Flaravel-php-session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgauge%2Flaravel-php-session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgauge","download_url":"https://codeload.github.com/cgauge/laravel-php-session/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247940443,"owners_count":21021973,"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":["hacktoberfest","laravel","php","session"],"created_at":"2024-11-06T13:23:16.454Z","updated_at":"2025-04-08T22:31:41.784Z","avatar_url":"https://github.com/cgauge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Code Coverage](https://scrutinizer-ci.com/g/cgauge/laravel-php-session/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/cgauge/laravel-php-session/?branch=main)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cgauge/laravel-php-session/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/cgauge/laravel-php-session/?branch=main)\n\n# Laravel PHP Session ⛔\n\nThis library provides a NativeSessionUserProvider for Laravel.\n\n# Installation\n\n```bash\ncomposer require customergauge/session\n```\n\n# Usage\n\n### Auth configuration\n\nIn the `auth.php` file, add the following settings:\n\nDefault Guard\n\n```php\n    'defaults' =\u003e [\n        'guard' =\u003e 'php',\n        'passwords' =\u003e 'users',\n    ],\n```\n\nThe new Guard configuration\n```php\n    'guards' =\u003e [\n        'php' =\u003e [\n            'driver' =\u003e \\CustomerGauge\\Session\\NativeSessionGuard::class,\n            'provider' =\u003e \\CustomerGauge\\Session\\NativeSessionUserProvider::class,\n            'domain' =\u003e '.app.mydomain.com',\n            'storage' =\u003e 'tcp://my.redis.address:6379',\n        ],\n    ],\n```\n\n### Auth Middleware\n\nConfigure the `auth` middleware at `App\\Http\\Kernel` with `'auth:php'`\n\n### UserFactory\n\nThe last thing you'll need is to provide your own implementation of `UserFactory` and register it in a ServiceProvider.\n\n```\nfinal class NativeSessionUserFactory implements UserFactory\n{\n    public function make(array $session): ?Authenticatable\n    {\n        // $session here is the same as $_SESSION\n        \n        return new MyUserObject(\n            $session['id'],\n            $session['my_user_attribute'],\n        );\n    }\n}\n```\n\nIn the provider:\n```\n$this-\u003eapp-\u003ebind(CustomerGauge\\Session\\Contracts\\UserFactory, App\\Auth\\NativeSessionUserFactory::class);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgauge%2Flaravel-php-session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgauge%2Flaravel-php-session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgauge%2Flaravel-php-session/lists"}